使用登录代码帮助我 [英] help me out with a login code

查看:61
本文介绍了使用登录代码帮助我的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个文本框电子邮件文本框和密码文本框,我只需要单击登录按钮就可以登录,因为ima begginer可以帮助我提供登录代码.

i have 2 text boxes Email text box and password text box, all i need is when i clik on login button it signin, as i m a begginer help me with login code.

推荐答案

获取电子邮件和密码文本框中的值
检查数据库是否包含电子邮件和密码与文本框中给出的值匹配的任何记录
如果存在记录,则将用户重定向到相应页面
Take the values in email and password textbox
check the database if it contains any record whose email and password match with the values given in textboxes
if record exists then redirect the user to respective page


您可以将登录用作登录按钮单击事件
you can use login for as on login button click event
string str = "select * from empbirth where UserID=@userid and password=@pass";
            SqlConnection cnn=new SqlConnection();
            cnn.ConnectionString="Your connection string";
            cnn.Open();
            SqlCommand cmd = new SqlCommand(str, cnn);
            cmd.Parameters.AddWithValue("userid", txtUId.Text);
            cmd.Parameters.AddWithValue("pass", txtpwd.Text);
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
               //take any action
            }
else
{
Response.Write("INVALID ATTEMPT");
}


这篇关于使用登录代码帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆