我在from已经订定义了一个data空间A,但是我希望数据库动态绑定,并且能够使用a.recordset.recordcount来进行数据库的数据判断。现在的问题是,recordset不能使用。
用以下两句代码进行了数据路径指定和数据表的制定,但是recordset不能使用。 base_info.DatabaseName = App.Path & "\CUSTOMER_INFO.mdb"
base_info.RecordSource = "base_info"请高手指教。
用以下两句代码进行了数据路径指定和数据表的制定,但是recordset不能使用。 base_info.DatabaseName = App.Path & "\CUSTOMER_INFO.mdb"
base_info.RecordSource = "base_info"请高手指教。
解决方案 »
- 求vb 图
- 求帮助,关于ACTIVEX方面的问题
- 要怎么区别串口有没有被使用?
- 做了一个chm帮助文件,请问在vb的链接中该怎样打开它?谢谢,请帮忙!
- 这个网站:http://www.softwww.com 中的一款聊天软件,要出售源代码,我准备买一套,大家认为这样的软件的源代码值多少钱
- 一个关于MSFlexGrid的简单问题
- 请帮助推荐VB的好书-送100分
- 再续BOM算法
- 使用Webbrow控件获得网页时,可以不执行javascript代码吗?
- Field not updatable,Bound ProPerty Name:Text,Field Name:Currency!错误详细见内!
- 如何實現隱藏功能,急!!
- 如何取得硬盘物理序列号?
As String, MsgString As String) _
As ADODB.Recordset
ConnectString = "DBQ=" & DataBaseName & ";DefaultDir=;Driver={Microsoft Access Driver (*.mdb)};"
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sTokens() As String
On Error GoTo ExecuteSQL_Error
sTokens = Split(sql)
Set cnn = New ADODB.Connection
cnn.Open ConnectString
If InStr("INSERT,DELETE,UPDATE", _
UCase$(sTokens(0))) Then
cnn.Execute sql
MsgString = sTokens(0) & _
" query successful"
Else
Set rst = New ADODB.Recordset
rst.Open Trim$(sql), cnn, _
adOpenKeyset, _
adLockOptimistic
'rst.MoveLast 'get RecordCount
Set ExecuteSQL = rst
MsgString = "²éѯµ½" & rst.RecordCount & _
" Ìõ¼Ç¼ "
End If
Set rst = Nothing
Set cnn = Nothing
Exit Function
ExecuteSQL_Exit:
Set rst = Nothing
Set cnn = Nothing
Exit Function
ExecuteSQL_Error:
MsgString = "²éѯ´íÎó: " & _
Err.Description
Resume ExecuteSQL_Exit
End Function
请加base_info.RecordSource.refresh试试。