那一天

。。。。。。。。。。。。。。。。。。。。你輕輕地來,悄悄地走,留下一片曾經的溫暖

原创 SQL SERVER2005連接字串中的@3/29收藏

新一篇: 春---朱自清 | 旧一篇: 水晶報表:一張Letter紙上下各顯示固定的10筆3/25

下載了祭司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");

注:以上是C#的寫法,VB.NET則不需要@

发表于 @ 2006年03月29日 12:02:00|评论(loading...)|编辑

新一篇: 春---朱自清 | 旧一篇: 水晶報表:一張Letter紙上下各顯示固定的10筆3/25

评论

#烟雨阁 发表于2006-03-30 08:45:00  IP: 219.142.218.*
实际上C#下面把所有的 单个/ 就默认成转义字符(类似C语言下面的/n)要是路径下面就用//
发表评论  


当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
Csdn Blog version 3.1a
Copyright © daisylh