G
Guest
Using SQL 2005 I generated a SQL Script to create a DB Table and columns. in
VB.NET i use the StreamReader to read this file to a string, and I want to
execute the script in my application, so the app can create an identical
table at runtime.
Obvously if i simply run the SQL Script from the file, it works, and if I
copy the StreamReader String while debugging into a SQL query, it also works
(creates the table) fine. However, when the program steps to the
SqlCmd.ExecuteNonQuery( ), I get a SQL Exception, "Syntax error near....".
The sql script (and command string) are very long, (Many tables, many
properties... many "Syntax error near"). I've tried to Replace single
(apostrophe) ' with '' and even single (quote) " with "", but the same
result. How come if I paste the string directly from the app to the query
analizer it works, but errors out in the app? Any suggestions?
Thanks
MATT
VB.NET i use the StreamReader to read this file to a string, and I want to
execute the script in my application, so the app can create an identical
table at runtime.
Obvously if i simply run the SQL Script from the file, it works, and if I
copy the StreamReader String while debugging into a SQL query, it also works
(creates the table) fine. However, when the program steps to the
SqlCmd.ExecuteNonQuery( ), I get a SQL Exception, "Syntax error near....".
The sql script (and command string) are very long, (Many tables, many
properties... many "Syntax error near"). I've tried to Replace single
(apostrophe) ' with '' and even single (quote) " with "", but the same
result. How come if I paste the string directly from the app to the query
analizer it works, but errors out in the app? Any suggestions?
Thanks
MATT