我的机子是WIN7系统,在WIN7下开发的MFC ADO应用程序到XP上就不能运行了。

解决方案如下:

1、先下载下面的文件

32位WIN7系统:Msado60_Backcompat_i386.tlb

64位WIN7系统(INTEL平台):Msado60_Backcompat_i386.tlb 和Msado60_Backcompat_x64.tlb

64位WIN7系统(AMD平台):Msado60_Backcompat_i386.tlb 和Msado60_Backcompat_ia64.tlb

2、拿32位系统示例

注册Msado60_Backcompat_i386.tlb

1、将Msado60_Backcompat_i386.tlb复制到C:\Program Files\Common Files\System\ado\目录下

2、再将C:\Windows\Microsoft.NET\Framework\v4.0.30319\regtlibv12.exe复制到C:\Program Files\Common Files\System\ado\目录下

3、运行CMD,

分别输入:

pushd C:\Program Files (x86)\Common Files\System\ado\回车
regtlibv12.exe msado60_Backcompat_i386.tlb回车

注意:

32位系统需要注册Msado60_Backcompat_i386.tlb;

64位WIN7系统(INTEL平台)需要注册:
Msado60_Backcompat_i386.tlb和Msado60_Backcompat_x64.tlb这2个文件;

64位WIN7系统(AMD平台)需要注册:
Msado60_Backcompat_i386.tlb和Msado60_Backcompat_ia64.tlb这2个文件;

3、替换程序代码

如果是VC++

将:

#import "msado15.dll" no_namespace rename("EOF","EndOfFile")
替换为:

#import "msado60_Backcompat_i386.tlb" no_namespace rename("EOF","EndOfFile")
4、重新生成解决方案即可

(2013.7.8真正实践过,解决了我所遇到的问题)

转自http://blog.csdn.net/magic_andy/article/details/9225073在此表示感谢!