SQL SERVER2005連接字串中的@3/29

王朝c#·作者佚名  2006-12-16
窄屏简体版  字體: |||超大  

下載了祭司的Client-CallBack參考程式碼,在連接SQL SERVER2005時,將其中的

SqlConnection conn = new SqlConnection('data source=.;initial catalog=Northwind;user id=sa;password=test');

改為

SqlConnection conn = new SqlConnection('Data Source=DAISYLH\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True;Pooling=False');

時在DAISYLH\S處出現:無法辨認的溢出序列

若將DAISYLH\去掉,則出現:

An error has occurred while establishing a connection to the server.

When connecting to SQL Server 2005, this failure may be caused by the

fact that under the default settings SQL Server does not allow remote

connections. (provider: Named Pipes Provider, error: 40 - Could not

open a connection to SQL Server)

真是奇怪了,後來在這裏找到了解決方法,原來加一個@就正常了^__^

SqlConnection conn = new SqlConnection(@'Data Source=DAISYLH\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True;Pooling=False');

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航