关于rs的变量定义,解决即给分,急!!!

zjh216 2003-05-19 11:57:56
Option Explicit

Private Sub Combo1_Click()
Text1.Text = ""
Text1.SetFocus
Select Case Combo1.Text

Case "按身份证号"
Label3.Caption = "如:42015689851565"


Case "按姓名"
Label3.Caption = ""
Case "按出生日期"
Label3.Caption = "如:1999-9-8"
Case "按籍贯"
Label3.Caption = ""
Case "按性别"
Label3.Caption = ""
End Select
End Sub

Private Sub Command1_Click()

Set rs = New ADODB.Recordset

Select Case Combo1.Text
Case "按姓名"
CString = "huzhuming='"
Case "按性别"
CString = "xingbie='"
Case "按身份证号"
CString = "shengfenhao='"
Case "按出生日期"
CString = "shengri='"
Case "籍贯"
CString = "jiguan='"

End Select
CString = CString & Trim(Text1.Text) & "'"
rs.Open "select * from HUJI-3 where " & Trim(CString), conn, adOpenStatic, adLockReadOnly
If rs.RecordCount <> 0 Then
MSHFlexGrid1.Visible = True
Set MSHFlexGrid1.DataSource = rs
Text1.Text = ""
Text1.SetFocus
Else
MSHFlexGrid1.Visible = False
MsgBox "没有此记录"
Text1.Text = ""
Text1.SetFocus
End If
End Sub

Private Sub Command2_Click()
Unload Me
Load hecaozuo3
hecaozuo3.Show
End Sub

Private Sub Form_Load()
Label5.Left = (Me.ScaleWidth - Label5.Width) / 2
Label5.Top = 200

End Sub

系统提示 Private Sub Command1_Click()

Set rs = New ADODB.Recordset
rs变量未定义,请求帮助修改!如果还有其他问题请一并帮忙指出,谢谢!!!
...全文
23 点赞 收藏 7
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
zjh216 2003-05-20
有没有高手啊?
回复
zjh216 2003-05-20
我不知道才请教呀!到底怎么定义能说详细一点吗?
回复
PDK 2003-05-20
你的RS 是没有定义呀!!!1
回复
flxa 2003-05-20
把Set rs = New ADODB.Recordset


改为Dim Rs as new adodb.RecordSet

就OK了
回复
lihonggen0 2003-05-20

合为一句:
Dim Rs As New ADODB.Recordset
回复
lihonggen0 2003-05-20

Dim Rs As ADODB.Recordset
Set rs = New ADODB.Recordset
回复
lihonggen0 2003-05-20
引用Microsoft Active Data Object 2.X Library



Dim Rs As ADODB.Recordset
回复
相关推荐
发帖

1187

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2003-05-19 11:57
社区公告
暂无公告