Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
How can I read data from MS Access table and store them into variables?
Posted
Comments
VJ Reddy 17-Jun-12 13:02pm    
Thank you for viewing and accepting the solution :)

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.
 
Share this answer
 
Comments
Mohamed Mitwalli 14-Jun-12 1:38am    
5+
VJ Reddy 14-Jun-12 2:10am    
Thank you, Mohamed :)
Manas Bhardwaj 14-Jun-12 4:25am    
Correct +5
VJ Reddy 14-Jun-12 4:36am    
Thank you, Manas :)
Espen Harlinn 14-Jun-12 17:09pm    
Nice answer, 5'ed!
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900