我用的Vb编写的网站登录界面,上面分了类别,当输入帐号和密码之后,要求用户选择自己的权限类型,然后在登录,但是在代码的显示上,不知道如何将登录按钮的代码与帐号、密码和类别连接,设置错误,一直没有解决,现在用C#编写,那么类别的代码与登录按钮的代码功能如何实现?

解决方案 »

  1.   

    两者的思想几乎都查不多!
    可以使用一个dropdownList来实现用户类型的设置。
      

  2.   


    两者差不多 LZ可以去下载一个demo来研究
      

  3.   


    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号和密码不能为空!";
            }
        }啊哈哈,儿时滴代码