Connecting to access database using code
I a开发者_C百科m a student How to connect to access database using code ( not using wizard) and retrive values in the textbox in c# using visual studio 2008.
I have to extract 3 fields from the access database.
Do anybody know. Pl help.
OleDbConnection is the standard class to query an Access database. Here's an example.
Start by reading up on ADO.NET and then use the OleDb Data Provider. Once you have the values it should be trivial to put them into a text box.
Here is a good ADO.NET tutorial:
- http://www.codersource.net/asp-net/ado-net/c-and-ado-net.aspx
And some good OLEDB info:
- http://msdn.microsoft.com/en-us/library/6d9ew87b%28v=VS.71%29.aspx
In addition: Get the "Visual C# 2010 Samples" from
http://code.msdn.microsoft.com/cs2010samples/Wiki/View.aspx?title=Home
and look at the
"OLEDB: Demonstrates how to use a Microsoft Access database from C# by creating a dataset and adding tables to it."
sample.
精彩评论