Link to home
Start Free TrialLog in
Avatar of aplusexpert
aplusexpert

asked on

SMO Error - Cannot Connect to Server

Hello Friends,

I have SQL Script File for Creating Whole database.

I want to execute that "Script" file from my c# application.So I used SMO Object for it. But some how it is giving me error that "could not connect to the server".

I have also tried SqlHelper.ExecuteNonQuery(ScriptText). but throws error that
"Incorrect Systax near GO Statement"

Note that this same query is WORKING fine while executing direct from SQL SERVER. So, No Errors in Script File.

I am using SQL SERVER 2008 R2.

I also want to know the same logic will work in SQL SERVER 2005 ?

Please feel free to ask in case of any query

Thanks In Advance.
ASKER CERTIFIED SOLUTION
Avatar of JimFive
JimFive
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aplusexpert
aplusexpert

ASKER

Hey JimFive. Thanks for your response.


I have replace all "GO" Statement with ";". but Still i am getting the Same Error.
What is the actual value of ScriptText?
Partial Solution. didn't really work in our case