Using a database with C#
- by Mike
I have been trying to do something that I think would be really easy but have never used C# before and am having trouble with the details. I simple want to use a sql database with Visual C# Express 2008.
For testing purposes I have a datagrid on my form that can reflect changes to the db.
If i use this:
codesTableAdapter.Fill(dataSet1.codes);
The datagrid(dataset) will fill with the info from the sql database.
If i then do something like this:
codesTableAdapter.InsertQuery(txtCode.Text,txtName.Text);
codesTableAdapter.Fill(dataSet1.codes);
codesTableAdapter.Update(dataSet1);
dataSet1.AcceptChanges();
The datagrid reflects the changes but if close the program and go to the database the changes are not there. When I open the program again the changes are not there.
I have a feeling this isn't too clear as my understanding here is very low so please let me know what other info is needed.
Thanks