Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# - DataSet Not Saving
Message
From
20/04/2008 13:30:33
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01310720
Message ID:
01311963
Views:
19
<snip>
>SqlCommandBuilder oBuilder = new SqlCommandBuilder(oDataAdapter);
>oDataAdapter.Update(oDataSet, oDataSet.Tables[0].TableName);
>This throws an error because there is no data adapter. It works if I do:
>string sSelectCommand = "select * from Customers where CustomerKey = 1";
>SqlDataAdapter oDataAdapter = new SqlDataAdapter(sSelectCommand, oConnection);
>before hand. But my question is that this seems to be making a call into the DB just to save a new record.


This is because you are using the CommandBuilder. If you instead use some other methodology (such as rolling your own, as I have posted previously), and you don't use the CommandBuilder, than it will not make an extra call to the database ... it's the CommandBuilder that is doing this.

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform