Click here to Skip to main content
13,051,447 members (50,421 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear all,

I want to update my values in Datagridview which are coming from 2 can i update the values in a single sql statement....can anyone help me????please....
Posted 21-Sep-12 19:48pm
DaveAuld 22-Sep-12 1:58am
Terminate each half of the statement using a semi-colon. 'update fist table; update second table'
DaveAuld 22-Sep-12 1:59am
You haven't said if the table data is related, how did you pull the data through to the datagridview?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use Transactions - either at code level or DB level based on your workflow and need.

SQL Server Transactions and Error Handling[^]

MSDN: Local Transactions[^]
Using Transactions in ADO.NET[^]
Bulk Insert into SQL from C# App[^]

Further, if it's independent and not related data's of two table, then it can be sent to DB in one shot where you can execute two updates sequentially (UPDATE table1; UPDATE table2)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100