vb.net 连接SQL数据库登录代码
问题应该出在你的查询语句的结果没有值,你用你的查询语句到SQL中是否有返回值?记得加上你的条件,另外,你语句里这一句是多余的.Dim s As Object = sComm.ExecuteScalar 以下语句测试正常 Dim myCn As New SqlClient.SqlConnection Try myCn.ConnectionString = sConnString myCn.Open() Dim mySQL As String = "SELECT * FROM ygzl" Dim sComm As New SqlClient.SqlCommand(mySQL, myCn) If sComm.ExecuteScalar Then Dim User_MainForm As New Form1 User_MainForm.Show() Else MsgBox("用户名或密码不正确,请重试!") End If Catch ex As Exception MsgBox(ex.Message) Finally myCn.Close() '关闭连接 End Try
创新互联建站是一家专业提供光山企业网站建设,专注与成都网站设计、网站建设、外贸网站建设、H5技术、小程序制作等业务。10年已为光山众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。
如何用VB.NET制作账号自动登陆的程序
Private Sub SendBlogTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendBlogTimer.Tick
Dim textboxUserId As HtmlElement
Dim textboxPassword As HtmlElement
Dim buttonSubmit As HtmlElement
textboxUserId = SendBlogBrowser.Document.All("username")'获取用户名输入框
textboxPassword = SendBlogBrowser.Document.All("password")'获取密码输入框
buttonSubmit = SendBlogBrowser.Document.All("btnLogin")'获取登陆按钮
textboxUserId.SetAttribute("value","用户名")'给用户名输入框赋值
textboxPassword.SetAttribute("value","密码")'给密码框赋值
buttonSubmit.InvokeMember("click")’执行登陆按钮的单击
End Sub
其中的SendBlogBrowser为WebBrowser控件
vb.net 用户登录
哈哈简单哪
第一步:登陆网页代码
第二步:登陆以后判断是否登陆成功
有两种方法:1.获取网页代码,判断网页字符有无”登陆成功”字样
源代码:
2.就是判断网页是否跳转到了某一页
源代码:
两种方法结合起来用,可以判断网页是否无法连接
一个vb.net的用户登陆页面代码
Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click
If TextBox Text = Or TextBox Text = Then
Label Text = 请确认您的输入!
Return
End If
Dim sql As String = select * from pwd where stu_id=@stu_id and pwd=@pwd
Dim m As SqlCommand = New SqlCommand(sql conn)
m Parameters Add(New SqlParameter( @stu_id SqlDbType Int ))
m Parameters( @stu_id ) Value = TextBox Text
m Parameters Add(New SqlParameter( @pwd SqlDbType Char ))
m Parameters( @pwd ) Value = TextBox Text
Dim dr As SqlDataReader
conn Open()
dr = m ExecuteReader
If dr Read Then
Session( stu_id ) = TextBox Text
dr Close()
m Cancel()
Dim sql_ As String = update stu_base set point=point+ where stu_id=@stu_id
m = New SqlCommand(sql_ conn)
m Parameters Add(New SqlParameter( @stu_id SqlDbType Int ))
m Parameters( @stu_id ) Value = Session( stu_id )
m ExecuteNonQuery()
m Cancel()
Response Redirect( detail aspx?stu_id= Session( stu_id ) )
Else
Label Text = 您还没有注册或账号密码错误
End If
End Sub
Private Sub Button _Click(ByVal sender As System Object ByVal e As System EventArgs) Handles Button Click
TextBox Text =
TextBox Text =
lishixinzhi/Article/program/net/201311/13960
网页标题:vb.net登陆程序代码 VBNET教程
分享路径:http://scgulin.cn/article/hgghgc.html