C # Connect to an Access database

Source: Internet
Author: User

C # Connect to an Access database

Microsoft Office Access is a relational database management system that is released by Microsoft . It combines the two features of the Microsoftjet Database Engine and the graphical user interface and is one of the system programs for Microsoft Office.

For many small software, using an Access database is a good choice, and here's a quick introduction to using C # to connect to a database.

The first step: We build a project in vs2015 named Accesstest.

650) this.width=650; "src=" http://s2.sinaimg.cn/mw690/005B0qZNgy71rFb506521 "title=" "style=" border:0px; Vertical-align:middle; "/>

Project Establishment

Step Two: create a new Access database file named Test, where the location can be placed on the desktop

650) this.width=650; "src=" Http://s3.sinaimg.cn/mw690/005B0qZNgy71rFlD09Ya2 "title=" "style=" border:0px; vertical-align:middle; "/> database file

Step Three: Add a button to the WinForm form.

650) this.width=650; "src=" Http://s11.sinaimg.cn/mw690/005B0qZNgy71rFsUAOeda "title=" "style=" border:0px; Vertical-align:middle; "/>

Fourth Step: Add Reference System.Data.OleDb;

650) this.width=650; "src=" http://s1.sinaimg.cn/mw690/005B0qZNgy71rFCNEyI00 "title=" "style=" border:0px; Vertical-align:middle; "/>

Fifth Step: Double-click button to add code

650) this.width=650; "src=" http://s13.sinaimg.cn/mw690/005B0qZNgy71rGmvmsk9c "title=" "style=" border:0px; Vertical-align:middle; "/>

Path

650) this.width=650; "src=" http://s3.sinaimg.cn/mw690/005B0qZNgy71rGo1f7I92 "title=" "style=" border:0px; vertical-align:middle; "/> button code and comments

Last-step debug Run

650) this.width=650; "src=" http://s6.sinaimg.cn/mw690/005B0qZNgy71rGuUoex05 "title=" "style=" border:0px; Vertical-align:middle; "/>

Open Database  

650) this.width=650; "src=" Http://s6.sinaimg.cn/mw690/005B0qZNgy71rGxe2BTd5 "title=" "style=" border:0px; Vertical-align:middle; "/>

Close the database

Connection successful, congratulations, the database test connection is successful, then you can use the relevant statements to manipulate the database

This tutorial is prepared for the small white, do not like not to spray the following will introduce the database of some operational statements and practical use. Welcome to continue reading, the following is attached to the source address.

The database has to be built itself, and the path has to be modified.

Operating Environment VS2015

Free Source Address: http://down.51cto.com/data/2215791


This article is from the "World is the same" blog, please be sure to keep this source http://970076933.blog.51cto.com/9767314/1887862

C # Connect to an Access database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.