using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string username = Request.Form.Get("usernameTxt");
string password = Request.Form.Get("passwordTxt"); if (username == "calvin" && password == "123456")
{
string connectionName = "server=127.0.0.1;database = loginCalvin;uid=AMEBA\\Calvin;pwd=;";
string cmdtxt = "select count(*) from loginCalvin where fullname ='"+username+"' and password = '"+password+"'";
SqlConnection con = new SqlConnection(connectionName);
con.Open();
SqlCommand command = new SqlCommand(cmdtxt, con);
int count = Convert.ToInt32(command.ExecuteScalar());
Response.Write("The number of user: " + count);
Response.End();
}
else
{
Response.Redirect("Default.aspx?username="+username);
Response.End();
} }
}我想连接一个很简单的server 但是发生了以下的错误,请问是怎么一回事情,如果修改呢,谢谢各位高手,上面是代码已成功与服务器建立连接,但是在登录前的握手期间发生错误。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 0 - 管道的另一端上无任何进程。)
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string username = Request.Form.Get("usernameTxt");
string password = Request.Form.Get("passwordTxt"); if (username == "calvin" && password == "123456")
{
string connectionName = "server=127.0.0.1;database = loginCalvin;uid=AMEBA\\Calvin;pwd=;";
string cmdtxt = "select count(*) from loginCalvin where fullname ='"+username+"' and password = '"+password+"'";
SqlConnection con = new SqlConnection(connectionName);
con.Open();
SqlCommand command = new SqlCommand(cmdtxt, con);
int count = Convert.ToInt32(command.ExecuteScalar());
Response.Write("The number of user: " + count);
Response.End();
}
else
{
Response.Redirect("Default.aspx?username="+username);
Response.End();
} }
}我想连接一个很简单的server 但是发生了以下的错误,请问是怎么一回事情,如果修改呢,谢谢各位高手,上面是代码已成功与服务器建立连接,但是在登录前的握手期间发生错误。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 0 - 管道的另一端上无任何进程。)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货