第13章综合实例内容摘要:

7 23 Dim blnok As Boolean=True Private Sub btn2_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles btn2. Click () End Sub Private Sub btn1_Click (ByVal sender As , ByVal e As System. EventArgs) Handles btn1. Click Dim strsql As String strsql=select用户名,密码 from用户表 where用户名 =39。 amp。 amp。 39。 and密码 =39。 amp。 amp。 39。 1. 登录窗体的代码 2020/11/17 24 Dim myconn As New OleDbConnection Dim mym As New OleDbCommand Dim myadpt As New OleDbDataAdapter Dim myds As New DataSet Try 39。 判断用户名和密码是否为空 If =Or = Then MsgBox(用户名或密码不能为空 !) () () =Nothing Exit Sub End If 1. 登录窗体的代码 2020/11/17 25 39。 如果用户输入的数据都不为空,到数据库中去查找输入的用户名和密码是否正确 myconn. ConnectionString=Provider=. OLEDB.。 Data Source=通讯录 .mdb。 Persist Security Info=False myconn. Open() mym. CommandText=strsql mym. Connection=myconn myadpt. SelectCommand=mym myadpt. Fill(myds) Dim mytable As New DataTable mytable=myds. Tables(0) If mytable. Rows. Count=0 Then MsgBox(用户名或密码输入错误 !请重新输入。 ) () 1. 登录窗体的代码 2020/11/17 26 () = Else blnok=True Me. Close() End If Catch ex As Exception MsgBox() Finally myconn. Close() End Try End Sub 1. 登录窗体的代码 2020/11/17 27 Private Sub chb1_CheckedChanged (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles chb. CheckedChanged If chb1. Checked=True Then ComboBox1. Enabled=True Else ComboBox1. Enabled=False ComboBox1. Text= End If End Sub „ Private Sub chb4_CheckedChanged (ByVal sender As System. Object, ByVal e As _ System. EventArgs) Handles Chb4. CheckedChanged 2. 查询窗体的代码 2020/11/17 28 If Chb4. Checked = True Then ComboBox4. Enabled = True Else ComboBox4. Enabled = False ComboBox4. Text = End If End Sub Private Sub Chb5_CheckedChanged Handles Chb5. CheckedChanged If Chb5. Checked = True Then ComboBox5. Enabled = True Else ComboBox5. Enabled = False 2. 查询窗体的代码 2020/11/17 29 ComboBox5. Text = End If End Sub Private Sub Chb6_CheckedChanged Handles Chb6. CheckedChanged If Chb6. Checked。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。