通过网络的Microsoft SQL Server 2014。 Oledb连接字符串 [英] Microsoft SQL Server 2014 over network. Oledb Connection String

查看:218
本文介绍了通过网络的Microsoft SQL Server 2014。 Oledb连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到合适的Microsoft SQL服务器连接字符串,这是2014开发人员版本。
我当前的提供者是这样:

I cannot find an appropriate connection string to a Microsoft SQL server, it's the 2014 developer edition. My current provider is this:

string strAccessConn = "Provider=SQLNCLI11;Data Source=10.211.55.7;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User Id=pos;Password=password;";

但是,我收到此错误,
错误

However, I get this error, Error

作为参考,这是我的源代码。

For reference, this is my source code.

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。

I want to use the OleDbConnector.

谢谢!

推荐答案

仅测试一下,尝试添加连接: msdn.microsoft.com/en-us/library/ms171887.aspx

Just to test, try adding the connection thus : msdn.microsoft.com/en-us/library/ms171887.aspx

单击值字段中的省略号(...)按钮以打开连接属性对话框以构建连接字符串

" Click the ellipses (...) button in the Value field to open the Connection Properties dialog box to build your connection string "

有魔术

这篇关于通过网络的Microsoft SQL Server 2014。 Oledb连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆