Option Explicit
Private Sub Option1_Click()
Option1.Value = True
End Sub
Private Sub Option2_Click()
Option2.Value = True
End Sub
Private Sub Option3_Click()
Option3.Value = True
End SubPrivate Sub Command1_Click()
Form2.Show
Me.Hide
End SubPrivate Sub Command2_Click()
Dim 用户名 As String
Dim 密码 As String
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim StrSQL As String
Dim bo As Boolean
bo = False
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\桌面\教务\db1.mdb"
用户名 = Trim(Text1.Text)
密码 = Trim(Text2.Text)
StrSQL = "select * from 用户 where 用户名= '" & 用户名 & "'and 密码 ='" & 密码 & "'"
rs.Open StrSQL, conn, adOpenKeyset, adLockPessimistic
If 用户名 = "" Or 密码 = "" Then MsgBox "对不起,用户或密码不能为空!请重新输入!"
Else
If rs.EOF = True Then
MsgBox "对不起,无此用户或者密码不正确!请重新输入!"
Else
bo = True
End If
End If
If bo = True Then
If Option1.Value = True Then
Form3.Show
Form1.Hide
ElseIf Option2.Value = True Then
Form5.Show
Form1.Hide
Else: Option3.Value = True
Form4.Show
Form1.Hide
End If
End If
End SubPrivate Sub Command3_Click()
Unload Me
End Sub
Private Sub Option1_Click()
Option1.Value = True
End Sub
Private Sub Option2_Click()
Option2.Value = True
End Sub
Private Sub Option3_Click()
Option3.Value = True
End SubPrivate Sub Command1_Click()
Form2.Show
Me.Hide
End SubPrivate Sub Command2_Click()
Dim 用户名 As String
Dim 密码 As String
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim StrSQL As String
Dim bo As Boolean
bo = False
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\桌面\教务\db1.mdb"
用户名 = Trim(Text1.Text)
密码 = Trim(Text2.Text)
StrSQL = "select * from 用户 where 用户名= '" & 用户名 & "'and 密码 ='" & 密码 & "'"
rs.Open StrSQL, conn, adOpenKeyset, adLockPessimistic
If 用户名 = "" Or 密码 = "" Then MsgBox "对不起,用户或密码不能为空!请重新输入!"
Else
If rs.EOF = True Then
MsgBox "对不起,无此用户或者密码不正确!请重新输入!"
Else
bo = True
End If
End If
If bo = True Then
If Option1.Value = True Then
Form3.Show
Form1.Hide
ElseIf Option2.Value = True Then
Form5.Show
Form1.Hide
Else: Option3.Value = True
Form4.Show
Form1.Hide
End If
End If
End SubPrivate Sub Command3_Click()
Unload Me
End Sub
解决方案 »
- 很烦的问题,如何不字体打印成长型或者扁型? 头痛中!!!!!
- VB连接Access路径设置问题
- 如何得知用户切换到了其他程序,也就是说当前程序失去了焦点?
- 用copy语句备份数据库后程序找不到原数据库路径
- 怎样通过一张表中记录的表名查n张表?
- [----指纹开发----]如何用VB进行指纹开发?
- 如何用VB删除 带有特殊符号的文件夹。(图)
- 怎么样清除文件内容
- 一个很难,非高手不能回答的问题,请各位高手指点!
- 很急:我在ActirveReport的pageheader和detail中用line划线作表格,为什么每行的线是断开的。我该怎样做表格报表。切切,先谢了!
- 大哥大姐帮帮忙
- 高手请进来看看
StrSQL2 = "select 职业 from 用户,学生,教师,管理员 where 用户.用户名=学生用户名 and 用户.用户名=教师.用户名 and 用户.用户名=管理员.用户名"
If StrSQL2 = Lable4.Caption Then
Option1.Value = True
End Sub
Private Sub Option2_Click()
StrSQL2 = "select 职业 from 用户,学生,教师,管理员 where 用户.用户名=学生用户名 and 用户.用户名=教师.用户名 and 用户.用户名=管理员.用户名"
If StrSQL2 = Lable4.Caption Then
Option2.Value = True
End Sub
Private Sub Option3_Click()
StrSQL2 = "select 职业 from 用户,学生,教师,管理员 where 用户.用户名=学生用户名 and 用户.用户名=教师.用户名 and 用户.用户名=管理员.用户名"
If StrSQL2 = Lable5.Caption Then
Option3.Value = True
End Sub