当前位置:编程学习 > asp >>

用asp 登陆网页代码。。急

用户名、密码和用户类型是sql数据库中的表单中的数据,数据库已经和网页连接上。 要个详细 易懂的代码 。 急 。成功后加送100分
追问:初学sql 对asp 网页不是很明白   这个代码放在哪里用呀   具体一点 谢了
答案:SqlConnection myConn = new SqlConnection("server=(local);database=chaoshi;uid=sa;pwd=100427");
                myConn.Open();
                SqlCommand myComm = new SqlCommand("select count(*) from yonghu where Id='" + TextBox1.Text.Trim() + "'and Pwd='" + TextBox2.Text + "'", myConn);
                int i = (int)myComm.ExecuteScalar();
                if (i == 0)
                {
                    Response.Write("<script>alert('用户名或密码不正确!')</script>");
                }
                else
                {
                    Response.Write("<script>alert('登录成功!')</script>");
                }

上一个:asp运行时出现的错误:ASP服务器发现运行时错误: 错 误 码:0x80040E14 错误代码:conn.Execute(strSql)
下一个:asp.net中split(|)什么意思

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,