简体   繁体   English

使用代码连接到Access数据库

[英]Connecting to access database using code

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. 我是一名学生如何使用代码(不使用向导)连接到Access数据库并使用Visual Studio 2008在C#中检索文本框中的值。

I have to extract 3 fields from the access database. 我必须从访问数据库中提取3个字段。

Do anybody know. 有人知道吗? Pl help. 请帮助。

OleDbConnection is the standard class to query an Access database. OleDbConnection是查询Access数据库的标准类。 Here's an example . 这是一个例子

Start by reading up on ADO.NET and then use the OleDb Data Provider. 首先阅读ADO.NET,然后使用OleDb数据提供程序。 Once you have the values it should be trivial to put them into a text box. 一旦有了这些值,将它们放入文本框应该是微不足道的。

Here is a good ADO.NET tutorial: 这是一个很好的ADO.NET教程:

And some good OLEDB info: 和一些好的OLEDB信息:

In addition: Get the "Visual C# 2010 Samples" from 此外:从以下位置获取“ Visual C#2010示例”

http://code.msdn.microsoft.com/cs2010samples/Wiki/View.aspx?title=Home 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." “ OLEDB:通过创建数据集并向其中添加表,演示了如何使用C#中的Microsoft Access数据库。”

sample. 样品。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM