2012-02-26 8 views
0

このコードを実行しようとしていますが、「オーバーロードの解決に失敗しました」というエラーが表示されます。あなたがMS SQL Serverを管理する場合vb.netサーバー接続のオーバーロード

Overload resolution failed because no accessible 'New' can be called with these arguments: 
'Public Sub New(serverInstance As String)': Value of type 'System.Data.OleDb.OleDbConnection' cannot be converted to 'String'. 
'Public Sub New(sqlConnection As System.Data.SqlClient.SqlConnection)': Value of type 'System.Data.OleDb.OleDbConnection' cannot be converted to 'System.Data.SqlClient.SqlConnection'. 
'Public Sub New(sci As Microsoft.SqlServer.Management.Common.SqlConnectionInfo)': Value of type 'System.Data.OleDb.OleDbConnection' cannot be converted to 'Microsoft.SqlServer.Management.Common.SqlConnectionInfo'. 

答えて

0

、あなたがSqlConnectionを望んではなく、一般的なOleDbConnection:ここ

Conn = New OleDbConnection(ConnectionString)  
Dim serverConn As New Server(New ServerConnection(Conn)) 

は完全なエラーです。

OleDbConnectionSqlConnectionに置き換えるか、最初に明示的な接続をインスタンス化せずにNew Server()ConnectionStringを渡します。

関連する問題