Can't find Microsoft.SqlServer.ConnectionInfo.dll assembly file?
-
30-09-2019 - |
문제
I'm trying to dynamically get a databases Table structure using only C# code as follows:
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
public class LoadStuff
{
...
public void LoadDatabase(string vDatabaseName)
{
using (var vSqlConnection = new SqlConnection(DatabaseConnectionString))
{
var vConnection = new ServerConnection(vSqlConnection);
var vServer = new Server(vConnection);
var vDatabase = vServer.Databases[vDatabaseName];
var vTables = vDatabase.Tables;
}
}
}
However, I cannot find the .dll file to add a reference too. I'm using Visual Studio 2010 Professional. Any suggestions?
해결책
It is located in c:\program files\microsoft sql server\xxx\sdk\assemblies on my machine. Where xxx is the SQL Server version number (90 or 100). Not sure how it got there.
다른 팁
Please right click your solution and select 'Add reference' and then select the following dlls:
- C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.SMO
- C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.ConnectionInfo
- C:\WINDOWS\assembly\GAC_MSIL\Microsoft.SqlServer.Management.Sdk.sfc
제휴하지 않습니다 StackOverflow