kilic.net

SqlCommandBuilder

sqlcommandbuild

kilic.net

:: navigate ::

:: photography ::

http://weblog.kilic.net/images/tokyo-disneyland.jpg

SqlCommandBuilder

Posted 2003-10-07

Just gotta say that the SqlCommandBuilder class absolutely rocks! For simple CRUD operations you should do yourself a favour and take a look at this. Usage is as simple as:

SqlDataAdapter da = new SqlDataAdapter(“SELECT * FROM Pubs”, connectionString);

SqlCommandBuilder bld = new SqlCommandBuilder(da);

da.UpdateCommand = bld.GetUpdateCommand();

da.InsertCommand = bld.GetInsertCommand();

da.DeleteCommand = bld.GetDeleteCommand();

make your changes to your DataSet and then call the Update method on your DataAdapter to get the changes back to SQL and voila!