类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
操作系统:2003,数据库:sqlserver2000。程序中的ConnectionString为:"workstation id=\"HUST-QJA9VNLTQR\";packet size=4096;user id=sa;data source=localhost;persist security info=False;initial catalog=JiaoGuanDB"运行open()函数出现错误:An unhandled exception of type System.Data.SqlClient.SqlException occurred in system.data.dll
Additional information: 系统错误。
DefaultDomain: Loaded c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll, No symbols loaded.
dataBase1: Loaded F:\study_code\test1\dataBase1\dataBase1\bin\Debug\dataBase1.exe, Symbols loaded.
dataBase1.exe: Loaded c:\windows\assembly\gac\system.data\1.0.5000.0__b77a5c561934e089\system.data.dll, No symbols loaded.
dataBase1.exe: Loaded c:\windows\assembly\gac\system\1.0.5000.0__b77a5c561934e089\system.dll, No symbols loaded.
dataBase1.exe: Loaded c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.dll, No symbols loaded.
dataBase1.exe: Loaded c:\windows\assembly\gac\system.enterpriseservices\1.0.5000.0__b03f5f7f11d50a3a\system.enterpriseservices.thunk.dll, No symbols loaded.
dataBase1.exe: Loaded c:\windows\assembly\gac\system.xml\1.0.5000.0__b77a5c561934e089\system.xml.dll, No symbols loaded.
dataBase1.exe: Loaded c:\windows\assembly\gac\mscorlib.resources\1.0.5000.0_zh-chs_b77a5c561934e089\mscorlib.resources.dll, No symbols loaded.
An unhandled exception of type System.Data.SqlClient.SqlException occurred in system.data.dll
Additional information: 系统错误。
The program [3856] dataBase1.exe has exited with code 0 (0x0).
无从下手,请指点!谢谢!!
网友回答:
在你的 user id=sa;后面加上password=xxxx;如果口令为空则为:password=;
参照:www.connectionstrings.com
Standard Security:
"Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;"
- or -
"Server=Aron1;Database=pubs;User ID=sa;Password=asdasd;Trusted_Connection=False"
(booth connection strings produces the same result)
Trusted Connection:
"Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
- or -
"Server=Aron1;Database=pubs;Trusted_Connection=True;"
(booth connection strings produces the same result)
(use serverName\instanceName as Data Source to use an specifik SQLServer instance, only SQLServer2000)
Connect via an IP address:
"Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;"
(DBMSSOCN=TCP/IP instead of Named Pipes, at the end of the Data Source is the port to use (1433 is the default))
在ide里的设计器里连一下,看看连接字符串是什么就知道了。