Microsoft Access与Windows Server 2008中的Asp.net连接 [英] Microsoft Access connection with Asp.net in windows server 2008

查看:123
本文介绍了Microsoft Access与Windows Server 2008中的Asp.net连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我写了一小段代码来连接MS Access数据库和Asp.net ..

< pre lang =cs> con = new OleDbConnection( Provider = Microsoft.Jet.OLEDB.4.0; + 数据源= + Server.MapPath( 〜/ MYDB.mdb));
con.Open();





我在win server 2008中托管了这个网站它连接了,但在插入查询期间它说操作必须是一个可更新的查询



我的访问数据库具有完全权限..完全控制..



而在win server 2003上托管同样的东西..它没有给出任何错误..



我在win server 2008中需要它



为了摆脱这个问题,我已经找到了另一个与DSN连接的选项..但是在win server 2008中我无法找到MSAcess驱动程序..



为此我使用了32位ODBC exe ..并用数据库创建了DSN ..



现在我有了写下这段代码:

  protected   void  Page_Load( object  sender,EventArgs e)
{
OdbcConnection DbConnection = new OdbcConnection( DSN = MYDSN);
尝试
{

DbConnection.Open();
}
catch (Exception ex){ throw ex; }
finally {DbConnection.Close(); }
}
但它说:

ERROR [IM006] [Microsoft] [ODBC驱动程序管理器]驱动程序' s SQLSetConnectAttr失败





请建议我以任何方式让我得到在win server 2008中通过Asp.net在MS Access中插入记录



谢谢

Krunal

解决方案

64位Windows操作系统不支持MS Jet驱动程序。您需要安装 MS Access数据库引擎2010 [ ^ ]在Windows Server 2008上。之后,更改连接字符串 [ ^ ]:

提供者= Microsoft。 ACE 。< span class =code-leadattribute> OLEDB 。 12  .0; 数据来源= \\serverName\shareName\folder\myAccessFile.mdb; 





祝你好运!


Hello everyone,

I have written a small piece of code to connect MS access database with Asp.net..

con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + "Data Source=" + Server.MapPath("~/MYDB.mdb"));
           con.Open();



I have hosted this website in win server 2008 it gets connected , but during insert query it says "Operation must be an updateable query"

my access db is having full rights..with full control..

whereas the same thing when hosted on win server 2003.. it doesnt gives any error..

I need it in win server 2008

To get rid of this , i have look for an another option to get connection with DSN .. but in win server 2008 i couldnt find MSAcess driver..

for this i have used 32 bit ODBC exe.. and created DSN with the db..

now i have written this piece of code :

protected void Page_Load(object sender, EventArgs e)
   {
       OdbcConnection DbConnection = new OdbcConnection("DSN=MYDSN");
       try
       {

           DbConnection.Open();
       }
       catch (Exception ex) { throw ex; }
       finally { DbConnection.Close(); }
   }
But it says :

ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed



Please suggest me any way so that i could get insertion of records in MS Access through Asp.net in win server 2008

Thanks
Krunal

解决方案

64bit Windows OS does not supports MS Jet drivers. You need to install MS Access Database Engine 2010[^] on Windows server 2008. After that, change connection string[^]:

Provider=Microsoft.ACE.OLEDB.12.0; Data Source=\\serverName\shareName\folder\myAccessFile.mdb;



Good luck!


这篇关于Microsoft Access与Windows Server 2008中的Asp.net连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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