争怎路由网:是一个主要分享无线路由器安装设置经验的网站,汇总WiFi常见问题的解决方法。

一个容易的用户登陆程序……

时间:2024/7/8作者:未知来源:争怎路由网人气:

Content-Type: Text/Plain; charset="gb2312"
Content-Transfer-Encoding: 8bit

以下程序是用来验证用户登录的共有两个按钮,一个是用来提交的,一个是用来重填的,页面部分就很简单了,两个文本框,两个按钮,这里页面的代码就不写了:)

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox3.Text = "" Or TextBox4.Text = "" Then
Label35.Text = "请确认您的输入!"
Return
End If
Dim sql As String = "select * from pwd where stu_id=@stu_id and pwd=@pwd"
Dim comm As SqlCommand = New SqlCommand(sql, conn)
comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
 comm.Parameters("@stu_id").Value = TextBox3.Text
comm.Parameters.Add(New SqlParameter("@pwd", SqlDbType.Char, 16))
comm.Parameters("@pwd").Value = TextBox4.Text
Dim dr As SqlDataReader
conn.Open()
dr = comm.ExecuteReader
If dr.Read Then
Session("stu_id") = TextBox3.Text
dr.Close()
comm.Cancel()
Dim sql_3 As String = "update stu_base set point=point+1 where stu_id=@stu_id"
comm = New SqlCommand(sql_3, conn)
comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
comm.Parameters("@stu_id").Value = Session("stu_id")
 comm.ExecuteNonQuery()
comm.Cancel()
Response.Redirect("detail.aspx?stu_id='" & Session("stu_id") & "'")
Else
Label35.Text = "您还没有注册或账号密码错误"
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub 

关键词:一个容易的用户登陆程序……




Copyright © 2012-2018 争怎路由网(http://www.zhengzen.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版