读取Access数据库 [英] Reading Access database

查看:75
本文介绍了读取Access数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从MS Access表中读取数据并将其存储到变量中?

How can I read data from MS Access table and store them into variables?

推荐答案

要从Access database读取和写入数据,Typed DataSet功能可以使用.使用类型化的数据集时,每个TableRow都会创建一个strongly typed class,以便可以像properties 一样访问Table 的列,而无需将列名硬编码为字符串.

在此处 http://msdn.microsoft.com/zh-cn/library/ms171897(v = vs.80).aspx [用于从DataBase和使用反射将DataTable保存到数据库中 [
To read and write data from Access database the Typed DataSet feature can be used. With typed dataset a strongly typed class is made for each Table and Row so that the columns of the Table can be accessed like properties without hard coding the Column names as strings.

A Walkthrough on Creating a Dataset with the Dataset Designer is given here http://msdn.microsoft.com/en-us/library/ms171897(v=vs.80).aspx[^] in which Access version of Northwind sample database can be used as stated in the Note on that article.

After creation of typed data set, to fill and save each data table corresponding TableAdapter has to be used due to strongly typed nature of the DataTable. However, in this CodeProject article
General purpose class to fill DataTable(s) from DataBase and to save DataTable(s) to DataBase using reflection[^]
a general purpose class is given to read data from database and write data to database for all tables of the database using Type DataSet. An example with MS Accesss database is also given in the article.

I think it may be helpful.




在Google上搜索"c#访问数据库教程",您将获得大约200万个结果.

这是其中之一:
http://www.java2s.com/Tutorial/CSharp/0560__ADO.Net/ReaddatafromAccessdatabase.htm [ ^ ]


瓦莱里.
Hi,

Search on Google for "c# access database tutorial", you''ll get about 2 million results.

Here is one of them:
http://www.java2s.com/Tutorial/CSharp/0560__ADO.Net/ReaddatafromAccessdatabase.htm[^]


Valery.


这篇关于读取Access数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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