“未注册课程” VB6打开记录集时出错 [英] "Class not registered" error when opening recordset using VB6

查看:73
本文介绍了“未注册课程” VB6打开记录集时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始遇到这个问题。不知道它是如何启动的,但是我知道我禁用了启动时的某些Windows服务,并删除了一些odbc(可能是mysql odbc数据源),但是我在以下方面使用了MS SQL 2000。

I started getting this problem recently. Don't know how it started but I know I disabled some windows services that startup, and deleted some odbc, probably a mysql odbc data source but I'm using MS SQL 2000 for the following.

尝试填充记录集时收到错误,错误详细信息是:
运行时错误'-2147221164(80040154)':类未注册。

I get the error when trying to populate the recordset, and the error details are: "Run-time error '-2147221164 (80040154)': Class not registered."

Private Sub cmdTestConnection_Click()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;Initial Catalog=dbname;Data Source=mrtestpc2\sql2000pwd;Extended Properties=uid=sa;pwd=passwordhere;"
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
conn.Open
rs.Open "select * from tablename", conn 'ERROR here
MsgBox CStr(rs.RecordCount)
End Sub

可能与此相关的引用我打勾的问题是:
Microsoft ActiveX数据对象2.8库

The references that might be relevant to this issue which I have ticked is: Microsoft ActiveX Data Objects 2.8 Library

我已经尝试了以上引用的不同版本,从2.8到2.5,但仍然遇到相同的问题。

I've tried with different versions with the above reference, from 2.8 to 2.5 but still get the same problem.

编辑:我正在尝试弄清是否是MDAC问题。
编辑:我正在运行Windows XP SP3。

I'm trying to figure out whether it's an MDAC issue. I'm running windows xp sp3.

推荐答案

您正在运行Windows 7 SP1吗? Microsoft通过一些更改导致了该问题。请参阅以下文章

Are you running Windows 7 SP1? Microsoft caused that problem with some changes. See the following article.

这篇关于“未注册课程” VB6打开记录集时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆