Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 dataadapter.update(datatable) not working

Author  Topic 

sanghavi17389
Starting Member

26 Posts

Posted - 2012-05-03 : 10:17:34
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "UPDATE DimRequestMasterTestHS SET [RunningBoard] = ?,[DutyBoard] =? ,[DriverId] =? ,[PublicServiceCode] = ?,[ServiceCode] = ?,[DepotCode] = ?,[Direction] = ?,[EOJMethod] = ?, JourneyNo=? WHERE [RequestID]=? ";
daUpdate.UpdateCommand = cmd;
cmd.Connection = myStagingConnection;
//daUpdate = new SqlDataAdapter("Select * From DimRequestMasterTestHS", myStagingConnection);
//daUpdate.Fill(ds.Tables["PositionUpdates"]);
//cmdBuilder = new SqlCommandBuilder(da);
//daUpdate.UpdateCommand = cmdBuilder.GetUpdateCommand();
daUpdate.UpdateBatchSize = 1000;
daUpdate.Update(ds , "PositionUpdates");

daUpdate is DataAdapter Object

harshal sanghavi

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-03 : 14:35:37
what do you mean not working? is it throwing some error or update is not happening?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -