Click here to Skip to main content
15,902,922 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I got this error An unhandled exception of type 'Microsoft.SqlServer.Management.Smo.SmoException' occurred in Microsoft.SqlServer.SmoExtended.dll
while running the windows application(.exe).

I have written code for a button

C#
string sqlConnectionString = cn.ConnectionString.ToString();
           SqlConnection conn = new SqlConnection(sqlConnectionString);
           StringBuilder sb = new StringBuilder();
           string script = string.Empty;
           Server server = new Server(new ServerConnection(conn));


while running this code i got error this .
I have taken server connection.
would u pls resolve this error
Posted
Comments
[no name] 4-Dec-15 1:17am    
Please provide the message and inner exception details why it unhandledexception occured.
Which line exactly?
TarunKumarSusarapu 4-Dec-15 1:29am    
Server server = new Server(new ServerConnection(conn));
Why you need this line in code?
TarunKumarSusarapu 4-Dec-15 2:09am    
to show the version of the server and need to run the scripts in database dynamically

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900