新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
VB.NET中怎么实现用户登录页面,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
成都创新互联主营攸县网站建设的网络公司,主营网站建设方案,成都APP应用开发,攸县h5微信小程序开发搭建,攸县网站营销推广欢迎攸县等地区企业咨询
VB.NET用户登录页面代码示例:
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e
As System.EventArgs) Handles
Button2.ClickIf TextBox3.Text = "" Or
TextBox4.Text = "" ThenLabel35.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.Textcomm.Parameters.Add(New SqlParameter
("@pwd", SqlDbType.Char, 16))comm.Parameters("@pwd").Value =
TextBox4.TextDim 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
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。