Click here to Skip to main content
15,916,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi friends in my project i want to create an object of server class so for that i want to add Microsoft.SqlServer.Management.Smo name space but i am not getting it in add reference window I have add Microsoft.SqlServer.Smo ,connectionInfo namespaces but Microsoft.SqlServer.Management.Smo this name space is not getting I am using sql 2008 so what to do .thanks
Posted
Comments
Samprith 31-Oct-11 6:06am    
How to get a reference to Microsoft.SqlServer.Management.Common????
maheshpardeshi 31-Oct-11 6:10am    
in visual studio click on solution explorer then right click on references click add refference then add these reference

1 solution

Right click on project>>Add reference>>click browse button find the below path
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies

Microsoft.SqlServer.Smo.dll

add the reference
 
Share this answer
 
Comments
maheshpardeshi 14-Sep-11 4:12am    
thanks i done it but new problem arise it give me exception error fail to connect server="Mah...."
my code is:
Server srv = new Server(@"Data Source=MAHESH-F7B2934C\BABA;Initial Catalog=te;Integrated Security=True;Pooling=False");
srv.ConnectionContext.LoginSecure = true;
srv.ConnectionContext.Connect();
foreach (Database mydb in srv.Databases)
{
MessageBox.Show(mydb.Name);
}
maheshpardeshi 14-Sep-11 4:49am    
it works i add this code thanks
SqlConnection con = new SqlConnection(@"Data Source=MAHESH-F7B2934C\BABA;Initial Catalog=te;Integrated Security=True;Pooling=False");
ServerConnection sc = new ServerConnection(con);
Server srv = new Server(sc);

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