C#编写一个登录界面 我用的Vb编写的网站登录界面,上面分了类别,当输入帐号和密码之后,要求用户选择自己的权限类型,然后在登录,但是在代码的显示上,不知道如何将登录按钮的代码与帐号、密码和类别连接,设置错误,一直没有解决,现在用C#编写,那么类别的代码与登录按钮的代码功能如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 两者的思想几乎都查不多!可以使用一个dropdownList来实现用户类型的设置。 两者差不多 LZ可以去下载一个demo来研究 private void StudentLogin()//学生登录 { if (txtsno.Text != "" && txtpw.Text != "") { if (txtsno.Text.Length > 5) { string str = "select count(*) from TB_ACCOUNT A,TB_MEMBER B where B.MEMBER_CODE='" + txtsno.Text.Replace("'", "\"") + "' and decode(B.WEBPWD,null,'" + txtpw.Text.Trim().Replace("'", "\"") + "')='" + txtsno.Text.Trim().Replace("'", "\"").Substring(txtsno.Text.Length - 6, 6) + "' and A.MEMBER_ID=B.MEMBER_ID and B.ACCOUNT_NO<>0 and B.ACCOUNT_NO=A.ACCOUNT_NO or B.MEMBER_CODE='" + txtsno.Text.Replace("'", "\"") + "' and B.WEBPWD='" + txtpw.Text.Trim().Replace("'", "\"") + "' and A.MEMBER_ID=B.MEMBER_ID and B.ACCOUNT_NO<>0 and B.ACCOUNT_NO=A.ACCOUNT_NO"; if (Method.Proplogin(str))//判断是否是合法用户 { string selectmemidstr = "select C.MEMBER_ID,D.STATUS, C.MEMBER_CODE,D.ACCOUNT_NO,MEMBER_NAME from TB_MEMBER C,TB_ACCOUNT D where C.MEMBER_CODE='" + txtsno.Text.Replace("'", "\"") + "' and C.MEMBER_ID=D.MEMBER_ID and D.ACCOUNT_NO=C.ACCOUNT_NO";//获取MEMBER_ID DataSet memidDs = new DataSet(); memidDs = Method.getDataSetBySQL(selectmemidstr, "ORCLE");//取MEMBER_ID Page.Session["memid"] = memidDs.Tables[0].Rows[0].ItemArray[0]; if (memidDs.Tables[0].Rows[0].ItemArray[1].ToString() == "1" || memidDs.Tables[0].Rows[0].ItemArray[1].ToString() == "2")//判断该卡是不是正常状态 { Page.Session["CustomerCode"] = memidDs.Tables[0].Rows[0].ItemArray[2].ToString(); Page.Session["CardState"] = memidDs.Tables[0].Rows[0].ItemArray[1].ToString(); Page.Session["ACCOUNT_NO"] = memidDs.Tables[0].Rows[0].ItemArray[3].ToString(); Session[SystemConst.USERIDKEY] = memidDs.Tables[0].Rows[0].ItemArray[0].ToString(); Session["identity"] = "student"; Session["func"] = "card"; Response.Redirect("MainIndex.aspx"); } else { informlb.Text = "该卡不处于正常使用状态"; } }//end if(Method.Proplogin(str)) else { informlb.Text = "输入错误,请检查"; } }//end if (txtsno.Text.Length > 6) else { informlb.Text = "学号输入错误,请检查"; } }//end if(txtsno.Text != "" && txtpw.Text != "") else { informlb.Text = "ID号和密码不能为空!"; } }啊哈哈,儿时滴代码 winform datagridview 添加数据如何 WPF 下 放置一个webbrowser ,上面还可以显示一个wpf控件吗? 如何读取xml文件文本? 我想用c#做一个客户端程序 C#中水晶披表的问题,请教各位了 winform文档窗口背景图片怎样最大化? C#送分问题12 个性化窗体?? 求助.net上传dbf文件问题 DevExpress的安装 引用kernel32.dll进行串口通讯时getCommMask方法 关于系统框架的搭建问题
可以使用一个dropdownList来实现用户类型的设置。
两者差不多 LZ可以去下载一个demo来研究
private void StudentLogin()//学生登录
{
if (txtsno.Text != "" && txtpw.Text != "")
{ if (txtsno.Text.Length > 5)
{
string str = "select count(*) from TB_ACCOUNT A,TB_MEMBER B where B.MEMBER_CODE='" + txtsno.Text.Replace("'", "\"") + "' and decode(B.WEBPWD,null,'" + txtpw.Text.Trim().Replace("'", "\"") + "')='" + txtsno.Text.Trim().Replace("'", "\"").Substring(txtsno.Text.Length - 6, 6) + "' and A.MEMBER_ID=B.MEMBER_ID and B.ACCOUNT_NO<>0 and B.ACCOUNT_NO=A.ACCOUNT_NO or B.MEMBER_CODE='" + txtsno.Text.Replace("'", "\"") + "' and B.WEBPWD='" + txtpw.Text.Trim().Replace("'", "\"") + "' and A.MEMBER_ID=B.MEMBER_ID and B.ACCOUNT_NO<>0 and B.ACCOUNT_NO=A.ACCOUNT_NO"; if (Method.Proplogin(str))//判断是否是合法用户
{
string selectmemidstr = "select C.MEMBER_ID,D.STATUS, C.MEMBER_CODE,D.ACCOUNT_NO,MEMBER_NAME from TB_MEMBER C,TB_ACCOUNT D where C.MEMBER_CODE='" + txtsno.Text.Replace("'", "\"") + "' and C.MEMBER_ID=D.MEMBER_ID and D.ACCOUNT_NO=C.ACCOUNT_NO";//获取MEMBER_ID
DataSet memidDs = new DataSet();
memidDs = Method.getDataSetBySQL(selectmemidstr, "ORCLE");//取MEMBER_ID
Page.Session["memid"] = memidDs.Tables[0].Rows[0].ItemArray[0]; if (memidDs.Tables[0].Rows[0].ItemArray[1].ToString() == "1" || memidDs.Tables[0].Rows[0].ItemArray[1].ToString() == "2")//判断该卡是不是正常状态
{
Page.Session["CustomerCode"] = memidDs.Tables[0].Rows[0].ItemArray[2].ToString();
Page.Session["CardState"] = memidDs.Tables[0].Rows[0].ItemArray[1].ToString();
Page.Session["ACCOUNT_NO"] = memidDs.Tables[0].Rows[0].ItemArray[3].ToString();
Session[SystemConst.USERIDKEY] = memidDs.Tables[0].Rows[0].ItemArray[0].ToString();
Session["identity"] = "student";
Session["func"] = "card";
Response.Redirect("MainIndex.aspx");
}
else
{
informlb.Text = "该卡不处于正常使用状态";
}
}//end if(Method.Proplogin(str))
else
{
informlb.Text = "输入错误,请检查";
}
}//end if (txtsno.Text.Length > 6)
else
{
informlb.Text = "学号输入错误,请检查";
}
}//end if(txtsno.Text != "" && txtpw.Text != "")
else
{
informlb.Text = "ID号和密码不能为空!";
}
}啊哈哈,儿时滴代码