Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Query success in MMS, failure in code
mike
Mar 1 2010 6:21 AM
2.7k
Reply
Hey,
I have two databases and i use schema compare in Visual Studio 2008 to generate a script to upgrade one to the other. Now i have written some code which needs to execute this script on a database. If i create the script, and then open up Management Studio and paste it in and run it, the query executes successfully. However, if i let my code do it an error is returned;
"Incorrect syntax near the keyword Go", "Incorrect syntax near the keyword SET" etc.
Does anyone know why these two methods of running the same script produce different results? Once i've connected to the server and started the transaction i simply use; (any pointers on this would be great!!)
SqlCommand
command =
new
SqlCommand
(script, conn, tn);
command.ExecuteNonQuery();
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Hey i want some sql queries with their optimized queries
Table Query