注册 登录
编程论坛 VB6论坛

Adodc1.Refresh from子语法错误,急啊.那位大哥哥大姐姐告诉小妹啊?

bingning0029 发布于 2007-05-28 00:33, 3033 次点击
可以给我改改吗?下面是我的代码
Private Sub Command1_Click(Index As Integer)
Dim sql As String
If Check1.Value = vbChecked Then
sql = "书名" & Trim(Text1.Text & " ") & "'"
End If
If Check2.Value = vbcheckde Then
If Trim(sql) = "" Then
sql = "类别='" & Trim(Combo1.Text & " ") & "'"
Else
sql = sql & "and 书名='" & Trim(Combo1.Text & "'") & "'"
End If
End If
If Check3.Value = vbcheckde Then
If Trim(sql) = "" Then
sql = "作者='" & Trim(Text2.Text & " ") & "'"
Else
sql = sql & "and 作者='" & Trim(Text2.Text & " ") & "'"
End If
End If
If Check4.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "出版社='" & Trim(Text3.Text & " ") & "'"
Else
sql = sql & "and 出版社='" & Trim(Text3.Text & " ") & "'"
End If
End If
If Check5.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "书籍编号='" & Trim(Text4.Text & " ") & "'"
Else
sql = sql & "and 书籍编号='" & Trim(Text4.Text & " ") & "'"
End If
End If
If Trim(sql) = " " Then
MsgBox "请选择查询方式!", vbOKOnly + vbExclamation
Exit Sub
End If
Adodc1.RecordSource = "select * from sjxx where " & sql
Adodc1.Refresh 就是这句错误,不知道怎么改啊。
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
End Sub


提示FROM子语法错误,Adodc1.Refresh不能实现。在线等。小妹谢谢了
9 回复
#2
zhulei19782007-05-28 14:34

Private Sub Command1_Click(Index As Integer)
Dim sql As String
If Check1.Value = vbChecked Then
sql = "书名='" & Trim(Text1.Text & " ") & "'"
End If
If Check2.Value = vbcheckde Then
If Trim(sql) = "" Then
sql = "类别='" & Trim(Combo1.Text & " ") & "'"
Else
sql = sql & " and 类别='" & Trim(Combo1.Text & " ") & "'"
End If
End If
If Check3.Value = vbcheckde Then
If Trim(sql) = "" Then
sql = "作者='" & Trim(Text2.Text & " ") & "'"
Else
sql = sql & " and 作者='" & Trim(Text2.Text & " ") & "'"
End If
End If
If Check4.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "出版社='" & Trim(Text3.Text & " ") & "'"
Else
sql = sql & " and 出版社='" & Trim(Text3.Text & " ") & "'"
End If
End If
If Check5.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "书籍编号='" & Trim(Text4.Text & " ") & "'"
Else
sql = sql & " and 书籍编号='" & Trim(Text4.Text & " ") & "'"
End If
End If
If Trim(sql) = " " Then
MsgBox "请选择查询方式!", vbOKOnly + vbExclamation
Exit Sub
End If
Adodc1.RecordSource = "select * from sjxx where " & sql
Adodc1.Refresh 就是这句错误,不知道怎么改啊。
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
End Sub

[此贴子已经被作者于2007-5-28 15:01:08编辑过]

#3
bingning00292007-05-29 01:43
还是不行啊?
#4
bingning00292007-05-29 01:48

太感谢了 感谢啊 ~!!!

#5
bingning00292007-05-29 01:57
ok了 再次感谢
#6
youyou_jie2007-05-29 17:43
我也遇到同样的问题了,LZ怎么解决了的呢?哪个高手帮忙指导指导了啊~~~  我QQ:651218589 大侠们帮忙了啊
#7
youyou_jie2007-05-29 17:48
帮帮忙了,等待中~~~~  这个问题解决不了我就快疯了, 快答辩了, 好多东西做起有问题了
#8
gyll2010-04-30 17:42
怎么解决的啊
#9
yomy12162013-07-15 10:15
回复 6楼 youyou_jie
你把commandtype 改成8-adccmdunknown,就可以了  我也在网上百度许久  自己研究明白了啊。
#10
yomy12162013-07-15 10:16
回复 9楼 yomy1216
你把commandtype 改成8-adccmdunknown,就可以了  我也在网上百度许久  自己研究明白了啊。
1