微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

一个vb.net的用户登陆页面代码

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.ClickTextBox1.Text = ""TextBox2.Text = ""End Sub

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐