Run SQL Server script from C# code
-
Hi friends, I want to run sql server 2000 script (abc.sql) file from my C# application. Can you guide me?? Regards,
Sushant Duggal.
-
Hi friends, I want to run sql server 2000 script (abc.sql) file from my C# application. Can you guide me?? Regards,
Sushant Duggal.
-
Hi friends, I want to run sql server 2000 script (abc.sql) file from my C# application. Can you guide me?? Regards,
Sushant Duggal.
I would suggest that you look at using
Process.Start
to runosql.exe
.the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before. -
Hi friends, I want to run sql server 2000 script (abc.sql) file from my C# application. Can you guide me?? Regards,
Sushant Duggal.
Sushant Duggal wrote:
Can you guide me??
You can run just about any SQL through a
SqlCommand
. Just read the file in to a string and dump the string into theSqlCommand
. NOTE:GO
is not SQL. It is a preprocessor command to Query Analyzer to tell it to split the file into batches. If your file hasGO
s in it, you need to split it up and send them as separateSqlCommand
s.
Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos
-
I would suggest that you look at using
Process.Start
to runosql.exe
.the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.Hi Pete, Thanks for your post. Can you tell me after starting the osql process, what I need to do. Regards,
Sushant Duggal.
-
Hi friends, I want to run sql server 2000 script (abc.sql) file from my C# application. Can you guide me?? Regards,
Sushant Duggal.
Thanks for the reply friends. Regards,
Sushant Duggal.