VB.NET的应用方式比较简单灵活,大多数开发人员在刚接触这门语言不久后就被他的灵活易用,功能强大等特点深深吸引住了。我们今天将会为大家介绍的实用技巧是VB.NET用户登录页面的实现方法,希望能给大家带来一些帮助。
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.Click- TextBox1.Text = ""
- TextBox2.Text = ""
- End Sub
VB.NET用户登录页面相关实现方法就为大家介绍到这里。
【编辑推荐】