135-1821-9792

VB.NET用户登录页面实现技巧分享

VB.NET的应用方式比较简单灵活,大多数开发人员在刚接触这门语言不久后就被他的灵活易用,功能强大等特点深深吸引住了。我们今天将会为大家介绍的实用技巧是VB.NET用户登录页面的实现方法,希望能给大家带来一些帮助。

VB.NET用户登录页面代码示例:

 
 
 
  1. Private Sub Button2_Click(ByVal 
    sender As System.Object, ByVal e 
    As System.EventArgs) Handles 
    Button2.Click 
  2. If TextBox3.Text = "" Or
     TextBox4.Text = "" Then 
  3. Label35.Text = "请确认您的输入!" 
  4. Return 
  5. End If 
  6. Dim sql As String = "select * 
    from pwd where stu_id=@stu_id 
    and pwd=@pwd" 
  7. Dim comm As SqlCommand = New 
    SqlCommand(sql, conn) 
  8. comm.Parameters.Add(New SqlParameter
    ("@stu_id", SqlDbType.Int, 4)) 
  9. comm.Parameters("@stu_id").Value = 
    TextBox3.Text 
  10. comm.Parameters.Add(New SqlParameter
    ("@pwd", SqlDbType.Char, 16)) 
  11. comm.Parameters("@pwd").Value = 
    TextBox4.Text 
  12. Dim dr As SqlDataReader 
  13. conn.Open() 
  14. dr = comm.ExecuteReader 
  15. If dr.Read Then 
  16. Session("stu_id") = TextBox3.Text 
  17. dr.Close() 
  18. comm.Cancel() 
  19. Dim sql_3 As String = "update 
    stu_base set point=point+1
     where stu_id=@stu_id" 
  20. comm = New SqlCommand(sql_3, conn) 
  21. comm.Parameters.Add(New SqlParameter
    ("@stu_id", SqlDbType.Int, 4)) 
  22. comm.Parameters("@stu_id").
    Value = Session("stu_id") 
  23. comm.ExecuteNonQuery() 
  24. comm.Cancel() 
  25. Response.Redirect("detail.aspx?
    stu_id='" & Session("stu_id") & "'") 
  26. Else 
  27. Label35.Text = "您还没有注册或账号密码错误" 
  28. End If 
  29. End Sub  
  30. Private Sub Button1_Click(ByVal 
    sender As System.Object, ByVal e As 
    System.EventArgs) Handles Button1.Click 
  31. TextBox1.Text = "" 
  32. TextBox2.Text = "" 
  33. End Sub 

VB.NET用户登录页面相关实现方法就为大家介绍到这里。


当前标题:VB.NET用户登录页面实现技巧分享
网站链接:http://www.wtcwzsj.com/article/dheiejd.html

其他资讯



Copyright © 2009-2022 www.wtcwzsj.com 青羊区广皓图文设计工作室(个体工商户) 版权所有 蜀ICP备19037934号