如何在ASP.NET-C#中连接MSAccess 2007数据库 [英] How to connect MSAccess 2007 database in ASP.NET-C#

查看:75
本文介绍了如何在ASP.NET-C#中连接MSAccess 2007数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

如何在ASP.NET-C#中连接MSAccess 2007数据库.
我正在使用Visual Studio 2008.iam试图建立一个网站以托管在Intranet中.


在此先感谢
谁能帮助我....

hi all

How to connect MSAccess 2007 database in ASP.NET-C#.
i am using visual studio 2008.iam trying to build a website to host in intranet.


thanks in advance
can any one help me....

推荐答案

选中此

ASP.Net连接到Access 2007数据库 [ ^ ]
Check this

ASP.Net Connecting to An Access 2007 DB[^]


导入名称空间
import the namespace
using System.Data.OleDb;



您可以这样写:



you can write like this:

string connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=yourDatabaseName.mdb;Persist Security Info=True";
OleDbConnection cn = new OleDbConnection(connection); 
OleDbDataAdapter da = new OleDbDataAdapter("Select * from <tablename>", cn);
DataSet ds = new DataSet();
da.Fill(ds);
</tablename>


如果将mdf文件放在服务器上的网络驱动器上,请同时更改连接字符串.并与数据库连接,请参见
使用MS Access 2007数据库的ADO.NET应用程序
以及更多有关google的结果
Google
If you put mdf file on network drive on server, change connection string as well.and to connect with database see
ADO.NET Application using MS Access 2007 database
and more results on google
Google


这篇关于如何在ASP.NET-C#中连接MSAccess 2007数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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