| | |
i cant save data on an access database
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2007
Posts: 3
Reputation:
Solved Threads: 0
Good day, I am learning C# and someone has given me a certain software to write for him. I have been trying to add a new record to the Access Database that has already been connected to the Visual C# Application (Using Visual C# 2005) , using the DataSource and the DataAdapter objects, though i am able to add a new record to the program, it doesn,t save when i click on the save icon on visual C#.
Can anyone give me some hints and directions as how to solve the above mentioned problem, thanks.
Fruce
Can anyone give me some hints and directions as how to solve the above mentioned problem, thanks.
Fruce
•
•
Join Date: Feb 2007
Posts: 3
Reputation:
Solved Threads: 0
there is no code. I have a database in microsoft access. i am working on visual C# 2005. i created a new windows application and then add the database from access on the form. when i tried to input some values onto the database and click the save icon, i realised it didnt save after i run the application again. i dont know what to do
•
•
Join Date: Mar 2007
Posts: 4
Reputation:
Solved Threads: 0
hello....i have the same problem...the button for the Save buttons looks like this:
There at pacientTableAdapter.Update(mamaDataSet);, I tried with pacientTableAdapter.Insert(the_required_fields); but that didn't work either
C# Syntax (Toggle Plain Text)
private void button1_Click(object sender, EventArgs e) { if (name.Text == "" || surname.Text == "" || age.Text == null || entryDate == null) MessageBox.Show("Please enter all the data before pressing Add"); else { mamaDataSet.PacientRow pr; int maxId; maxId = -1; foreach (mamaDataSet.PacientRow r in mamaDataSet.Pacient.Rows) { if (r.PacientId > maxId) maxId = r.PacientId; } maxId = maxId + 1; pr = (mamaDataSet.PacientRow)mamaDataSet.Pacient.NewRow(); pr.PacientId = maxId; pr.Name = name.Text; pr.Surname = surname.Text; bool b=false; try { pr.Age = int.Parse(age.Text); } catch (Exception es) { MessageBox.Show("Invalid age, please insert a number"); b = true; } if (b != true) { DateTime startD = entryDate.SelectionStart; pr.EntryDate = startD; mamaDataSet.Pacient.Rows.Add(pr); //daProducts.Update(dsStore1, "Products"); MessageBox.Show(maxId.ToString()); pacientTableAdapter.Update(mamaDataSet); } } }
There at pacientTableAdapter.Update(mamaDataSet);, I tried with pacientTableAdapter.Insert(the_required_fields); but that didn't work either
![]() |
Similar Threads
- save data to access database (VB.NET)
- load data from access database into form (VB.NET)
- I want to save in an access database (C)
- Inserting Data into Access Database (Java)
- Read data from Access Database through PHP (PHP)
- Create an Access Database using Java (Java)
Other Threads in the C# Forum
- Previous Thread: XmlSerializer issue.
- Next Thread: Help regarding cell click event in datagridview
| Thread Tools | Search this Thread |
.net access algorithm api array asp.net barchart bitmap box broadcast buttons c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ httpwebrequest image index input install java label libraries list listbox loop mandelbrot math mouseclick movingimage mysql mysql.data.client operator path photoshop php picturebox pixelinversion post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string study system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf xml





