level 1
asdin6243
楼主
在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL Network Interfaces, error: 25 - 连接字符串无效)
下面是我.6.ASP.CS的代码,接收5传给来的词,,就如上面的问题!
string id = Session["id"].ToString();
string pw = Session["pw"].ToString();
SqlConnection con = new SqlConnection
("server=.,database=login;uid=sa;pwd=asdin6243;");
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from login where username='" + id + "'and userpw='" + pw + "'", con);
int count = Convert.ToInt32(cmd.ExecuteScalar());
if (count < 0)
{
Response.Write("<b><font color='red'>非法登陆!</font></b>");
Response.Write("<p><a href='5.aspx'>进入登陆界面></a></p>");
return;
}
else
{
Response.Write("登陆成功");
}
}
}
2011年11月12日 08点11分
1
下面是我.6.ASP.CS的代码,接收5传给来的词,,就如上面的问题!
string id = Session["id"].ToString();
string pw = Session["pw"].ToString();
SqlConnection con = new SqlConnection
("server=.,database=login;uid=sa;pwd=asdin6243;");
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from login where username='" + id + "'and userpw='" + pw + "'", con);
int count = Convert.ToInt32(cmd.ExecuteScalar());
if (count < 0)
{
Response.Write("<b><font color='red'>非法登陆!</font></b>");
Response.Write("<p><a href='5.aspx'>进入登陆界面></a></p>");
return;
}
else
{
Response.Write("登陆成功");
}
}
}