c#,类、结构或接口成员声明中的标记“”无效
<scriptlanguage="C#"runat="server">//从配置文件web.config中读出数据库设置stringstrCnn=Configuratio...
<script language ="C#" runat ="server">
//从配置文件web.config中读出数据库设置
string strCnn = ConfigurationSettings.AppSettings["glCnnStr"];
{
// 校验用户是否有效
SqlConnection sqlCnn = new SqlConnection(strCnn);
string sUserID,sUserPwd;
sUserID=TextBox_UserID.Text.Trim();//读入用户输入的用户名和密码
sUserPwd =Textbox_UserPwd.Text.Trim();
String sSql="select * from T_Customer where Cust_ID ='" + sUserID + "'and Cust_Pwd='"+sUserPwd+"'";//根据输入的用户名和密码进行查询
SqlDataAdapter sqlDA = new SqlDataAdapter(sSql,sqlCnn);
sqlDA.MissingSchaemaAction = MissingSchemaAction.Addwithkey;
DataSet bsDataSet = new DataSet();
sqlDA.Fill(bsDataSet,"T_Customer");
DataTable dtCust = bsDataSet.Tables["T_Customer"];
if(dtCust.Rows.Count==1)
{
//将部分用户信息记录在Session变量中,该变量在Global.asax中已定义
Session["UserID"] = sUserID;
Session["UserName"]= dtCust.Rows[0]["Cust_Name"].ToString().Trim();
Session["UserSex"]=dtCust.Rows[0]["Cust_Sex"].ToString().Trim();
Session["UserRight"]=dtCust.Rows[0]["Cust_Right"];//0是会员,1是管理员
//清空购物车中的数据
DataTable dtShopCart = (DataTable)Session["dtShopCart"];
dtShopCart.Clear();
Response.Redirect("./BookNew.aspx");//显示新书推荐界面
}
else //非法用户
Label_Msg.Text="用户名或密码错误!请仔细核实后再次输入!" + "正确的用户名及密码,或忽略了大小写。";
sqlCnn.Close();
}
</script>
n多错误,高人帮忙 展开
//从配置文件web.config中读出数据库设置
string strCnn = ConfigurationSettings.AppSettings["glCnnStr"];
{
// 校验用户是否有效
SqlConnection sqlCnn = new SqlConnection(strCnn);
string sUserID,sUserPwd;
sUserID=TextBox_UserID.Text.Trim();//读入用户输入的用户名和密码
sUserPwd =Textbox_UserPwd.Text.Trim();
String sSql="select * from T_Customer where Cust_ID ='" + sUserID + "'and Cust_Pwd='"+sUserPwd+"'";//根据输入的用户名和密码进行查询
SqlDataAdapter sqlDA = new SqlDataAdapter(sSql,sqlCnn);
sqlDA.MissingSchaemaAction = MissingSchemaAction.Addwithkey;
DataSet bsDataSet = new DataSet();
sqlDA.Fill(bsDataSet,"T_Customer");
DataTable dtCust = bsDataSet.Tables["T_Customer"];
if(dtCust.Rows.Count==1)
{
//将部分用户信息记录在Session变量中,该变量在Global.asax中已定义
Session["UserID"] = sUserID;
Session["UserName"]= dtCust.Rows[0]["Cust_Name"].ToString().Trim();
Session["UserSex"]=dtCust.Rows[0]["Cust_Sex"].ToString().Trim();
Session["UserRight"]=dtCust.Rows[0]["Cust_Right"];//0是会员,1是管理员
//清空购物车中的数据
DataTable dtShopCart = (DataTable)Session["dtShopCart"];
dtShopCart.Clear();
Response.Redirect("./BookNew.aspx");//显示新书推荐界面
}
else //非法用户
Label_Msg.Text="用户名或密码错误!请仔细核实后再次输入!" + "正确的用户名及密码,或忽略了大小写。";
sqlCnn.Close();
}
</script>
n多错误,高人帮忙 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询