Microsoft SQL Server 2014 over Network.Oledb 连接字符串
本文关键字:Oledb 连接 字符串 Network over SQL Server 2014 Microsoft | 更新日期: 2023-09-27 18:33:22
我找不到与Microsoft SQL服务器的合适连接字符串,这是2014开发人员版本。我目前的提供者是这样的:
string strAccessConn = "Provider=SQLNCLI11;Data Source=10.211.55.7;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User Id=pos;Password=password;";
但是,我收到此错误,错误
作为参考,这是我的源代码。
string strAccessConn = "Provider=SQLNCLI11;Data Source=10.211.55.7,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User Id=pos;Password=password;";
string strAccessSelect = "SELECT userid FROM users";
DataSet myDataSet = new DataSet();
OleDbConnection myAccessConn = null;
try
{
myAccessConn = new OleDbConnection(strAccessConn);
}
catch (Exception ex)
{
Console.WriteLine("Error: Failed to create a database connection. 'n{0}", ex.Message);
Console.ReadLine();
}
try
{
OleDbCommand myAccessCommand = new OleDbCommand(strAccessSelect, myAccessConn);
OleDbDataAdapter myDataAdapter = new OleDbDataAdapter(myAccessCommand);
myAccessConn.Open();
myDataAdapter.Fill(myDataSet, "Police");
}
catch (Exception ex)
{
Console.WriteLine("Error: Failed to retrieve the required data from the DataBase.'n{0}", ex.Message);
Console.ReadLine();
return;
}
finally
{
myAccessConn.Close();
}
我想使用 OleDbConnector。
谢谢!
只是为了测试,请尝试添加连接: msdn.microsoft.com/en-us/library/ms171887.aspx
" 单击省略号 (...按钮以打开"连接属性"对话框以生成连接字符串"
有"魔力"