[英]sql server 2008 connection string error
I know this is a quite standard issue... but can't figure it out.. 我知道这是一个非常标准的问题...但无法弄清楚..
So here's what i want to do: 所以这就是我想要做的:
I want to connect to my local sql server .\\SQLEXPRESS by windows authentication. 我想通过windows身份验证连接到我的本地sql server。\\ SQLEXPRESS。 I can login by using the SQL Server Management Studio.
我可以使用SQL Server Management Studio登录。
My connection string is like this: 我的连接字符串是这样的:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Integrated Security=SSPI";
it throws me an error: 它给我一个错误:
Cannot open database "Sports" requested by the login. The login failed.
so i tried: 所以我试过了:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Trusted_Connection=True";
it gives me: 它给了我:
Invalid authorization specification
Then i tried: 然后我试过:
string connStr = "Provider=SqlOleDB;Data Source=.\\SQLExpress; Initial Catalog=Sports; Integrated Security=True";
it returns: 它返回:
No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).
Any ideas?? 有任何想法吗??
updates: i forgot to mention, i'm using virtual machine windows 7 running the sql server 2010 express. 更新:我忘了提,我正在使用运行sql server 2010 express的虚拟机Windows 7。 Is there anything to do with the virtual machine???
与虚拟机有什么关系???
Are you familiar with http://www.connectionstrings.com ?? 你熟悉http://www.connectionstrings.com吗?
I would try something like: 我会尝试类似的东西:
Server=.\\SQLExpress;Database=Sports;Integrated Security=SSPI
That should work, I hope (no need to specify a provider and all that stuff). 这应该工作,我希望(不需要指定提供者和所有那些东西)。
Yo, 哟,
Do u use some IDE? 你使用一些IDE吗? Like VS2008?
喜欢VS2008? First, try restart SqlServer in your Configuration Manager.
首先,尝试在Configuration Manager中重新启动SqlServer。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.