64位电脑revit2014安装失败Revit,遇到问题,求助!

如何在64位操作系统里让Revit的命令连接Access数据库_百度知道
如何在64位操作系统里让Revit的命令连接Access数据库
提问者采纳
在Revit的外部命令里打开一个数据库连接,使用了下面的代码。public class RevitCommand : IExternalCommand{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
UIApplication app = commandData.A
Document doc = app.ActiveUIDocument.D
//连接字符串
string strConn = @&Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test\test.&;
OleDbConnection odcConnection = new OleDbConnection(strConn);
//打开连接对象
// 此处无法正常打开
odcConnection.Open();
odcConnection.Close();
catch(Exception ex)
//提示The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.
TaskDialog.Show(&error&, ex.Message);
return Result.S
}} 在64位操作系统里却提示:The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine. 或者与此同意思的中文。使用与上面相同的数据库访问代码,可以在64位操作系统的.NET 的exe中打开数据库连接。下面代码是一个按钮的处理函数。
private void button1_Click(object sender, EventArgs e)
//连接字符串
string strConn = @&Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\test\test.&;
OleDbConnection odcConnection = new OleDbConnection(strConn);
//打开连接对象
odcConnection.Open();
odcConnection.Close();
catch (Exception ex)
MessageBox.Show(ex.Message,&error& );
}如何解决Revit下64位操作系统的数据库连接问题?早期Microsoft没有提供64位数据库引擎,后来才提供了为Office服务的数据库引擎。默认情况下没有安装到64位的操作系统中。在Revit的命令中,访问数据库,需要有与操作系统相配的office数据库引擎类型。你可以在这个页面下载64位的数据库访问引擎在上面的页面中提到,我们需要使用odbc数据库访问方式来访问数据库。下面是Revit代码[csharp] view plaincopy
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class RevitCommand : IExternalCommand
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
UIApplication app = commandData.A
Document doc = app.ActiveUIDocument.D
//连接字符串
string Driver = @&Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=c:\test\test.&;
OdbcConnection odbcConnection = new OdbcConnection();
odbcConnection.ConnectionString = D
//打开连接对象
odbcConnection.Open();
odbcConnection.Close();
catch(Exception ex)
TaskDialog.Show(&error&, ex.Message);
return Result.S
那为什么在.NET的exe程序却能打开数据库连接呢? 到默认情况下,.NET程序的目标平台是x86, 也就是32位的。32位oledb数据库引擎已经安装到系统中。所以exe中可以顺利打开数据库连接。叶雄进
Nov. 21. 2011Autodesk ADN
来自团队:
其他类似问题
为您推荐:
64位操作系统的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 revit安装失败 的文章

 

随机推荐