oledb连接异常
这是我的代码
string connectionString = @"Provider=SQLOLEDB;Data Source=Machine Name;Initial Catalog=MyTestDatabase;";
OleDbConnection conn = new OleDbConnection(connectionString);
DataTable result = new DataTable();
try
{
conn.Open();
OleDbCommand cmd = new OleDbCommand("get_holidays", conn);
cmd.CommandType = CommandType.StoredProcedure;
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
adapter.Fill(result);
}
在执行过程中抛出$Exception {"无效的授权规范"} conn.open()。
This is my code
string connectionString = @"Provider=SQLOLEDB;Data Source=Machine Name;Initial Catalog=MyTestDatabase;";
OleDbConnection conn = new OleDbConnection(connectionString);
DataTable result = new DataTable();
try
{
conn.Open();
OleDbCommand cmd = new OleDbCommand("get_holidays", conn);
cmd.CommandType = CommandType.StoredProcedure;
OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
adapter.Fill(result);
}
$exception {"Invalid authorization specification"} is thrown during
conn.open().
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
连接字符串格式:
或
Connection string format:
or
将
Integrated Security=SSPI
添加到您的连接字符串中,尤其是在未指定用户名和密码时。在这种情况下,当前 Windows 帐户 凭据用于身份验证。Add
Integrated Security=SSPI
to your connection string especially when username and password are not specified. In this case current Windows account credentials are used for authentication.尝试此连接字符串
如果在本地不起作用 - 那么您无权访问您的 Sql Server
Try this connection string
If will not work locally - then you have no access to your Sql Server
连接字符串
中没有用户名
和密码
no
username
andpassword
inconnection string