问题
I am 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.
回答1:
OleDbConnection is the standard class to query an Access database. Here's an example.
回答2:
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
回答3:
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.
来源:https://stackoverflow.com/questions/4995333/connecting-to-access-database-using-code