大哥大姐帮帮忙

liu2007010703 2009-11-24 03:56:46
[img=http://user.qzone.qq.com/963548839/infocenter?ptlang=2052&ADUIN=963548839&ADSESSION=1259046193&ADTAG=CLIENT.QQ.2587_Mysrv.0]大哥大姐我是新手希望数据库能连上单选按钮当单选按钮和数据库里的属性一致时可以打开下个画面帮帮忙。[/img]
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 Sub

Private Sub Command1_Click()
Form2.Show
Me.Hide
End Sub

Private 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 Sub

Private Sub Command3_Click()
Unload Me
End Sub



...全文
123 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
liu2007010703 2009-11-24
  • 打赏
  • 举报
回复
http://hi.csdn.net/space-4023163-do-album-picid-456387.html这个网址有个界面图片(我的空间)就是上面的要求
clear_zero 2009-11-24
  • 打赏
  • 举报
回复
你断点debug一下就知道了阿
liu2007010703 2009-11-24
  • 打赏
  • 举报
回复
liu2007010703 2009-11-24
  • 打赏
  • 举报
回复
liu2007010703 2009-11-24
  • 打赏
  • 举报
回复
我的登录界面有三种用户,既学生(label4),教师(label5),管理员(label6),学生,老师,和管理员设为单选按钮,登陆时先输入用户名和密码,然后点单选按钮,和数据库连接看是否正确,正确进去相应的界面我的数据库有4个(用户。学生,老师,管理员)
红叶哥 2009-11-24
  • 打赏
  • 举报
回复
结帖率:0.00%
  • 打赏
  • 举报
回复
你在option——click里面改 option的value。看起来就有毛病。
还有StrSQL2 = Lable5.Caption。
总之不知道你想得到什么目的。
liu2007010703 2009-11-24
  • 打赏
  • 举报
回复
大哥大姐们我的分不多能帮忙的谢谢啊
liu2007010703 2009-11-24
  • 打赏
  • 举报
回复
我想把单选按钮和数据库连接起来如下面的你看对吗?Private Sub Option1_Click()
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
  • 打赏
  • 举报
回复
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 Sub
你想干什么?
java小鸟 2009-11-24
  • 打赏
  • 举报
回复
没分,别人都不想看,呵呵

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧