Use Access database without data source in Delphi

Source: Internet
Author: User
Tags access database

When I do a good student management system, I found that to use the software must configure the database data source. So I wanted to get out of the data source version.

Tectonic thinking:

In Con1 ConnectionString has a link database file as a data source, then we can configure the data source with the database file.

So Baidu a bit data Source = DataSource path. The student data source is registered in the registry and the student data source name is equivalent to the path.

Ideas:

The first step: immediately think of to get the absolute path of the database.

Step Two: Code connectionstring, provider to write the driver name of the full data provider (such as

Provider=Microsoft.Jet.OLEDB.4.0 (Access data Engine)

, and data source is written as an absolute path.

Technical key:

1. Get the program directory, construct absolute path:

sDBPath = Extractfilepath (application. exename) + ' Dataname.mdb ';

2.con1. ConnectionString: = ' provider=microsoft.jet.oledb.4.0;data source= ' + sDBPath + ';

Steps:

One: There is such an interface

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.