I have an sql database (agentroster.sdf) in my Visual Basic 2010 Express solution, and I have been able to create a data source (AGENT_ROSTER), with the datatable. All this works, as far as I can tell.
However, I am trying to add a new row to this existing datatable (and thus, database) from ROSTER.xaml.vb, which is in the same project as the database. I will also need to delete records, and load a records' values into a set of variables, which will later be written back after changing. This system is necessary for my particular project.
However, I cannot figure out how to开发者_StackOverflow中文版 create a new row in this EXISTING datatable. I've already confirmed the connections and everything, and I don't want to have to create an entirely new connection on top of the existing one.
Help?
In C# you can do something similar to this:
var table = new DataTable();
var row = table.NewRow();
table.Rows.Add(row);
Of course table is essentially empty at this point but if your datatable came from a database then it has schema already and the new row will match it's schema.
精彩评论