同じネットワークにあるデータベースに接続するアプリケーションを実行しています。ping
DBMS は SQL Server 2005です。IP アドレスへの接続をテストしてから、ado.net でデータベースへの接続をテストしたいと思います。
Ping p = new Ping();
try
{
PingReply pingReply6 = p.Send(ip.Text);
MessageBox.Show("IP: " + pingReply6.Address + " \n Etat : " + pingReply6.Status);
string connexionString;
connexionString = @"Data Source=Owner;Initial Catalog=base;Integrated Security=true;";
IDbConnection connexion = new SqlConnection(connexionString);
try { connexion.Open(); MessageBox.Show(" the connection is established "); }
catch(Exception ex) { MessageBox.Show(ex.ToString()); }
}
catch { MessageBox.Show("Invalid IP"); }
ご覧のとおり、アドレス IP でデータベースに接続したいのですが、ping をテストすると動作しますが、サーバーでデータベースへの接続をテストすると動作しません。
- 接続文字列のエラーは何ですか?
- 自分のデータベースではなく、指定されたアドレス IP (Windows 認証) を持つ他のデータベースに接続するように接続文字列を変更するにはどうすればよいですか?