做查询的时候,遇到一个问题,每次查询没有结果显示,却总把数据库里的数据给修改了,郁闷呀!求救!
我用的是adodc控件绑定的数据库,代码如下:
Private Sub CancelButton_Click()
Dim intcount As Integer
For intcount = 0 To 15
Text1(intcount).Text = ""
Next intcount
End SubPrivate Sub Check1_Click(Index As Integer)
If Index = 0 Then
Text1(0).SetFocus
ElseIf Index = 1 Then
Text1(1).SetFocus
ElseIf Index = 2 Then
Text1(2).SetFocus
ElseIf Index = 3 Then
Text1(3).SetFocus
End If
End SubPrivate Sub Command1_Click(Index As Integer)
If Index = 0 Then
Adodc1.Recordset.MoveFirst
ElseIf Index = 1 Then
Adodc1.Recordset.MoveLast
ElseIf Index = 2 Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If
ElseIf Index = 3 Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If
ElseIf Index = 4 Then
frmBook.Show
Unload Me
ElseIf Index = 5 Then
Unload Me
End If
End SubPrivate Sub Form_Load()
Me.ZOrder 0
Adodc1.Refresh
' For intcount = 0 To 3
' Text1(intcount) = ""
' Next intcount
'Text1(0).SetFocus
End SubPrivate Sub OKButton_Click()
Dim s As String
If Check1(0).Value = 0 And Check1(0).Value = 0 And Check1(0).Value = 0 And Check1(0).Value = 0 Then
MsgBox "请选择查询标准", vbOKOnly, "提示"
Exit Sub
End If
If Check1(0).Value = 1 Then
s = "name= '" & Trim(Text1(0) & " ") & "'"
ElseIf Check1(1).Value = 1 Then
s = "zuozhe= '" & Trim(Text1(1) & " ") & "'"
ElseIf Check1(2).Value = 1 Then
s = "fenleihao= '" & Trim(Text1(2) & " ") & "'"
ElseIf Check1(3).Value = 1 Then
s = "chubanshe= '" & Trim(Text1(3) & " ") & "'"
End If
Adodc1.Recordset.Find s
If Adodc1.Recordset.EOF = True Then
MsgBox "对不起,您查找的记录不存在", vbOKOnly, "提示"
End If
End Sub
我用的是adodc控件绑定的数据库,代码如下:
Private Sub CancelButton_Click()
Dim intcount As Integer
For intcount = 0 To 15
Text1(intcount).Text = ""
Next intcount
End SubPrivate Sub Check1_Click(Index As Integer)
If Index = 0 Then
Text1(0).SetFocus
ElseIf Index = 1 Then
Text1(1).SetFocus
ElseIf Index = 2 Then
Text1(2).SetFocus
ElseIf Index = 3 Then
Text1(3).SetFocus
End If
End SubPrivate Sub Command1_Click(Index As Integer)
If Index = 0 Then
Adodc1.Recordset.MoveFirst
ElseIf Index = 1 Then
Adodc1.Recordset.MoveLast
ElseIf Index = 2 Then
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If
ElseIf Index = 3 Then
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If
ElseIf Index = 4 Then
frmBook.Show
Unload Me
ElseIf Index = 5 Then
Unload Me
End If
End SubPrivate Sub Form_Load()
Me.ZOrder 0
Adodc1.Refresh
' For intcount = 0 To 3
' Text1(intcount) = ""
' Next intcount
'Text1(0).SetFocus
End SubPrivate Sub OKButton_Click()
Dim s As String
If Check1(0).Value = 0 And Check1(0).Value = 0 And Check1(0).Value = 0 And Check1(0).Value = 0 Then
MsgBox "请选择查询标准", vbOKOnly, "提示"
Exit Sub
End If
If Check1(0).Value = 1 Then
s = "name= '" & Trim(Text1(0) & " ") & "'"
ElseIf Check1(1).Value = 1 Then
s = "zuozhe= '" & Trim(Text1(1) & " ") & "'"
ElseIf Check1(2).Value = 1 Then
s = "fenleihao= '" & Trim(Text1(2) & " ") & "'"
ElseIf Check1(3).Value = 1 Then
s = "chubanshe= '" & Trim(Text1(3) & " ") & "'"
End If
Adodc1.Recordset.Find s
If Adodc1.Recordset.EOF = True Then
MsgBox "对不起,您查找的记录不存在", vbOKOnly, "提示"
End If
End Sub
解决方案 »
- 求VB6英文版下载地址
- 高手请进来:VB+sqlserver
- 向大家请教一个简单的问题,谢谢
- 关于这样的界面采用什么方式比较好一点?请高手指点!!
- vb发邮件用jmail 还是 mapi呢?还是有别的方法?有什么区别呢?
- 如何实现”自定义【开始】菜单“里的“清除列表”按钮功能?
- 在API函数中有这个函数吗?DialogBox(hInst, (LPCTSTR)IDD_IP, hWnd, (DLGPROC)Ip),请指教!
- “CDate("12:30:00")-CDate("11:20:00")=4200(秒)”最简单的算法(或函数)是什么?
- 远程管理类软件是如何实现的?马上给分
- 非VB人员莫入
- 简单的关于拨号的问题
- 什么地方有msdn的下载?
那程序应该怎么改啊
执行的时候vb那条记录的书名就改成java了
If Adodc1.Recordset.EOF = True Then
MsgBox "对不起,您查找的记录不存在", vbOKOnly, "提示"
else
Text2.text = Acodc1.Recordset.Fields("Name")
End If