衢州华高国际班好吗:VB数据库的一个错误

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 09:49:51
If strNum = "" Then Exit Sub
strSQL1 = "select 读者数据.*,读者类别.*" & "From 读者数据,读者类别 where 类号=编号 and 借书证号='" & strNum & "'"

strSQL2 = "select distinct 借阅数据.条码,书名,索书号,借期,还期,已还,库号" & "From 借阅数据,馆藏书目 where 借阅数据.条码=馆藏书目.条码" & "and 借阅数据.借书证号='" & strNum & "'" & "order by 借期"
With Library_Manage.Library_Manage_Con
If .State = adStateClose Then .Open
Set objInfo = New Recordset
Set objInfo = .Execute(strSQL1)
Set objBooks = New Recordset
Set objBooks = .Execute(strSQL2)
End With

以上的代码有错误吗?我运行的时候总是说“借阅数据”附件有错误!麻烦大家帮帮忙!!

首先,有几处没留空格。试试这样:
strSQL1 = "select 读者数据.*,读者类别.* " & "From 读者数据,读者类别 where 类号=编号 and 借书证号='" & strNum & "'"
strSQL2 = "select distinct 借阅数据.条码,书名,索书号,借期,还期,已还,库号 " & "From 借阅数据,馆藏书目 where 借阅数据.条码=馆藏书目.条码 " & "and 借阅数据.借书证号='" & strNum & "' " & "order by 借期"