本人小白一个,求asp.net登陆注册页面代码
求详细代码 --------------------编程问答-------------------- 简单易懂的哈,哥们--------------------编程问答-------------------- Refer:
http://www.cnblogs.com/insus/archive/2013/05/01/3052604.html --------------------编程问答--------------------
输入账户,密码,点击登录,后台判断账号密码是否匹配。。
注册的话和你的界面一样,按钮就换成一个,提交按钮,输入账户,密码,点击提交按钮后台添加到数据库对应的表中 --------------------编程问答-------------------- 写个方法,两个参数。比如:
public int login(string name,string pwd)
{
int reval = 0;
string strsql = "select * from user where name='"+name+"' and pwd = '"+pwd+"'";
...
执行下
reval = DBHelper.ExectueSQL(strsql);
return reval;
}
然后点击登录时,调用 这个方法,把两个TextBox传进去,如果返回0则显示登录失败,1则成功跳转另一个页面,具体规则你自己定。 --------------------编程问答-------------------- http://www.51aspx.com/ --------------------编程问答-------------------- 这...... --------------------编程问答-------------------- protected void Page_Load(object sender, EventArgs e)
{
userName.Focus();
}
protected void btnLogin_Click(object sender, EventArgs e)
{
string m_connStr = "Initial Catalog=NO1;Data Source=(local);User ID=sa;Password=123";
if (userName.Text == "")
{
Response.Write("<script>alert('用户名不能为空!')</script>");
userName.Focus();
}
else
if (userPass.Text == "")
{
Response.Write("<script>alert('密码不能为空!')</script>");
userPass.Focus();
}
string strSQL = "select * from zhucexinxi where Name='" + userName.Text + "' AND Password='" + userPass.Text + "'";
SqlConnection conn = new SqlConnection(m_connStr);
conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter sql = new SqlDataAdapter(strSQL,conn);
sql.Fill(ds);
conn.Close();
if (ds.Tables[0].Rows.Count > 0)
{
Response.Redirect("main.aspx");
}
else
{
Response.Write("<script>alert('用户名或密码错误')</script>");
}
}
protected void btnRegist_Click(object sender, EventArgs e)
{
Response.Redirect("Register.aspx");
}
可以实现简单的功能 --------------------编程问答-------------------- 网上随便下个去吧
很多的 --------------------编程问答-------------------- 求注册页面详细代码 --------------------编程问答-------------------- 又看到一个求作业的。 看他这些人活跃度 我就知道 小朋友们还翻不了天。 以后饭碗还保得住 --------------------编程问答--------------------
求登录时验证 sql怎么写 --------------------编程问答-------------------- http://www.51aspx.com/ Up
补充:.NET技术 , ASP.NET