B
benji
Hi,
I'm using VS2008, and the dataset designer to access my SQL Server 2005 DB.
I can insert a row into a table and then call the adapter to update. No
problem, except I want to get back the ID field of the newly created row.
I've tried the following:
DataSet1.CustomersRow myrow = myCustomersTable.NewCustomersRow();
myrow.field1 = "xyz"
myCustomersTable.AddCustomersRow(myrow);
myCustomersAdapter.Update(myCustomersTable);
Label1.Text = myrow.NonGroupChellengeID.ToString()
This returns -1. I can get the right value if I access the row directly on
the datatable after calling update, but as it stands I just access the last
row, and that might not be clean. ANy suggestions for this? I have to imagine
this is a common scenario?
Thanks...
-Ben
I'm using VS2008, and the dataset designer to access my SQL Server 2005 DB.
I can insert a row into a table and then call the adapter to update. No
problem, except I want to get back the ID field of the newly created row.
I've tried the following:
DataSet1.CustomersRow myrow = myCustomersTable.NewCustomersRow();
myrow.field1 = "xyz"
myCustomersTable.AddCustomersRow(myrow);
myCustomersAdapter.Update(myCustomersTable);
Label1.Text = myrow.NonGroupChellengeID.ToString()
This returns -1. I can get the right value if I access the row directly on
the datatable after calling update, but as it stands I just access the last
row, and that might not be clean. ANy suggestions for this? I have to imagine
this is a common scenario?
Thanks...
-Ben