adodc 在winows7里的应用,提示错误430!急!!!!!
提示错误run - time error 430
class does not support Automation or does not suppot
expected inte易做图ce
代码
'数据库
Private mConn As New ADODB.Connection
Private mRst As New ADODB.Recordset
Private Sub Form_Load()
Dim sSQL As String
mConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\db.mdb;"
mConn.Open
End Sub
引用了ADO哪个版本?
ado data control 6.0 (sp6)
Windows7里面的软件不能用access数据库吗?是不是需要安装office之后才能有啊 楼主?问题解决了没?
我也遇到这个问题了,郁闷的要死
没有呢, 帮我多顶一顶,等高手来吧 http://download.csdn.net/detail/veron_04/1498324
没积分了,你的这个在Windows7里能用吗? ,你在这里回答,我把这里的分给你,没有下载的那个积分了
在Win7中,以管理员身份登录情况下可用。
'需要安装OFFICE,在:工程-》引用中,添加:Microsoft Activex Data Object 2.x Library
'OFFICE的版本可以是2003,也可以是2007,建议2003
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'函数功能:连接指定的数据库
'参数说明:cnnP:数据库连接对象;
' :adoP:数据集存储对象;
' :strPath:数据库路径;
' :strPassword:数据库密码;
'返回说明:True:连接成功 False:连接失败
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Public Function funConnectDataBase(cnnP As ADODB.Connection, adoP As ADODB.Recordset, ByVal strPath As _
String, ByVal strPassword As String) As Boolean
On Error GoTo errFunction
Set cnnP = New ADODB.Connection
Set adoP = New ADODB.Recordset
cnnP.Provider = "Microsoft.Jet.OLEDB.4.0"
cnnP.Open "Data Source = " & strPath & ";jet oledb:database password=" & strPassword
funConnectDataBase = True
Exit Function
errFunction:
funConnectDataBase = False
End Function
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'函数功能:关闭数据库连接对象和数据文件的关联
'参数说明:cnnP:数据库连接对象;
' :adoP:数据库存储对象;
'返回说明:True:关闭连接成功 False:关闭连接失败
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Public Function funCloseDataBase(cnnP As ADODB.Connection, adoP As ADODB.Recordset) As Boolean
On Error GoTo errFunction
Set adoP = Nothing
Set cnnP = Nothing
funCloseDataBase = True
Exit Function
errFunction:
funCloseDataBase = False
End Function
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'过程功能:对指定的对象执行指定的SQL语句
'参数说明:cnnP:ADO连接对象
' :adoP:ADO记录集对象
' :strSql:SQL语句
' :bolQueryRecord:是否是查询记录集
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Public Sub subExcuteSQL(cnnP As ADODB.Connection, adoP As ADODB.Recordset, strSql As String, bolQueryRecord _
As Boolean)
If bolQueryRecord Then '如果是查询记录集
adoP.Open strSql, cnnP, adOpenStatic, adLockBatchOptimistic
Else
cnnP.Execute strSql
End If
End Sub
你现在解决了吗 依照我给你的代码可以解决,步骤如下:
1、funConnectdatabase:连接数据库
2、subExcuteSql:执行sql查询
3、funClosedatabase:查询完毕,断开数据库连接
不知道你这具体得怎么用
如果:
数据库路径 为 " & App.Path & "\db.mdb;"
没有密码
SQL = " Select * from aaa where id=1"
*.Fields("shu")
那么:
具体得怎么用,放在Form_Load中,text1.text中显示*.Fields("shu")
Private Sub Form_Load()
End Sub
我试了试,还是430,你来具体的例子看看,谢谢啦 http://download.csdn.net/detail/veron_04/3827200
补充:VB , 控件