public bool Authenticate()
{
bool bRet = false;
string strPassword="";
//连接字符串
string strConn = System.Configuration.ConfigurationManager.AppSettings["dsn"];
//建立一个新的连接
SqlConnection cn = new SqlConnection(strConn);
//打开连接
cn.Open();//////异常提示:
//构造SQL语句字符串
string strSQL = "Select count(*) from TCustomer where CustomerName='";
strSQL += m_CustomerName;
strSQL += "'";
//构造Command对象
SqlCommand cmd = new SqlCommand(strSQL,cn);
int nCount = 0;
//执行SQL命令
nCount =(int) cmd.ExecuteScalar ();
//返回结果
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL
慕盖茨4494581