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
 two update

Author  Topic 

notsosuper
Posting Yak Master

190 Posts

Posted - 2005-08-17 : 13:33:48
if I want to put two update statement in one sub in vb.net. Is in it i need to use ; to add two statement to each other so it can execute onces?

Kristen
Test

22859 Posts

Posted - 2005-08-17 : 13:43:31
Yes

UPDATE Table1 SET Col1 = 'FOO' WHERE Col2 = 'BAR' ; UPDATE Table2 SET Col2 = 'BAR' WHERE Col1 = 'FOO'

should work

Kristen
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-17 : 13:43:55
Why aren't you using stored procedures?

Why don't you just have another line of code for the second update?

cmdUpdate1.ExecuteNonQuery()
cmdUpdate2.ExecuteNonQuery()

Tara
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-08-17 : 13:49:21
I'm shocked that you are dirtying your hands with application programming Tara!

Kristen
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-17 : 13:52:02
Rather than be bored during the slow times, keep busy with a technology that is related to your field but is unfamiliar to you!

Tara
Go to Top of Page
   

- Advertisement -