大哥们我很急,很急的,那位帮帮忙
using System;
using System.Data;
using System.Data.SqlClient;
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;
连接是这么写的
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["Con_guanliyuan"]);
string strCmd1 = "select count(*) from xuesheng_user where 用户名='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
SqlCommand myCommand1 = new SqlCommand(strCmd1, myConnection);
myCommand1.Connection.Open();
int flag1 = (int)myCommand1.ExecuteScalar();
myCommand1.Connection.Close();
红字处报错为:
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)