-
Save
I have tried this code to save records in C#.NET.
//Save
DataRow row = dataSet11.Student.NewStudentRow;
row.ItemArray(0) = textBox1.Text;
row.ItemArray(1) = textBox2.Text;
row.ItemArray(2) = textBox3.Text;
row.ItemArray(3) = textBox4.Text;
dataSet11.Student.AddStudentRow;
dataSet11.AcceptChanges;
But it doesn't work.
Any solution to this problem?
-
Try using the 'Update' method of the dataAdapter object. 'AcceptChanges' tells the dataSet to reset its dirty flags.
-
Do you come from VB?
You need function parentheses even for argument-less functions:
dataSet11.AcceptChanges();
Also array indexing is done using brackets:
row.ItemArray[0]
or ItemArray might even be the indexer (look it up in the reference):
row[0]