Accessing datatable without interface. [modified]
-
I've done a tbAdapter.fill(DataSet.datatable); How do I edit the datatable through code? I need to be able to add new rows to the table and I'm having trouble figuring out how. Anyone have a guide that demonstrates this though code? (IE, no interface for background processes). -- modified at 19:59 Thursday 29th June, 2006 I dont understand how to use dataSet.DataTable.addTableRow() if anyone cares to explain this to me (if it is what I'm even looking for). Thanks again.
-
I've done a tbAdapter.fill(DataSet.datatable); How do I edit the datatable through code? I need to be able to add new rows to the table and I'm having trouble figuring out how. Anyone have a guide that demonstrates this though code? (IE, no interface for background processes). -- modified at 19:59 Thursday 29th June, 2006 I dont understand how to use dataSet.DataTable.addTableRow() if anyone cares to explain this to me (if it is what I'm even looking for). Thanks again.
Adding a row to the table is really quite simple. You are looking for datatable.NewRow(); To add a new row you would do something like this:
DataRow newrow = datatable.NewRow(); // Create a new row
row[0] = "blah blah blah";
row[2] = ...
// add some more data to the row
...dataTable.Rows.Add(newrow); //add the row to the table
Basically it creates a new row based on the columns that you have in the already constructed table. You can also set values for different columns in the row like:
row["SomeColumn"] = "blah blah blah";
Thats really all there is to it :laugh: Hope that helps.
-
Adding a row to the table is really quite simple. You are looking for datatable.NewRow(); To add a new row you would do something like this:
DataRow newrow = datatable.NewRow(); // Create a new row
row[0] = "blah blah blah";
row[2] = ...
// add some more data to the row
...dataTable.Rows.Add(newrow); //add the row to the table
Basically it creates a new row based on the columns that you have in the already constructed table. You can also set values for different columns in the row like:
row["SomeColumn"] = "blah blah blah";
Thats really all there is to it :laugh: Hope that helps.
Thanks! worked like a charm...