English 中文(简体)
联系问题
原标题:Connection String Problem
  • 时间:2009-10-09 13:36:01
  •  标签:

我是一位方案家,试图教授自己C#。 Northwind.mdf database in a form. 我已利用数据库探索者将数据库附在表格中,测试连接图纽克也发挥了作用。 在连接线上,我使用<条码>服务器=/sqlexpress;信托_Connection=yes;数据库=北风。 这一联系在<代码>上失败。 SqlDataAdapter data Adapter = new SqlDataAdapter (selectCommand, connectionString); 谷歌没有帮助。 任何想法?

问题回答

情况如何?

<编码> 资料来源: SCEXPRESS;Initial Catalog= Northwind;Integrated Security=SSPI;

Right click on the connection in the "Database Explorer".
Click on "Properties".
See the "Connection String" in the properties window, with its value on the right.
Is this the same connection string, as the one you posted?

在这方面,我可以看到一个新编的薄子。

Data Source=.SQLEXPRESS;AttachDbFilename=C:UserskalpeshDocuments	est.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True

假设连接线的加强是正确的,你将不得不在组群中逃脱(如果它含有任何需要它的性质,例如反弹性质)

string connectionstring = @"Data Source=.SQLEXPRESS;AttachDbFilename=C:UserskalpeshDocuments	est.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

In your case, it should be the path to the Northwind.mdf located on your machine.
Does this work?





相关问题
热门标签