Connect to the Access database using C language

Source: Internet
Author: User
Tags odbc connection

The video shows how to connect to the MySQL database. It is troublesome to configure MySQL after installation. Therefore, I tried to connect to the Access database using the template provided by the instructor. Access is more convenient to use.
Almost all of them are installed with office.
First, search for odbc connection strings in Baidu to find asp connection Access method, but ODBC is common, so it can also be used directly.
Set
SQLCHAR ConnStrIn [MAXBUFLEN] = "DRIVER = {MySQL ODBC 5.1 Driver}; SERVER = 127.0.0.1; UID = root; PWD = root; DATABASE = test; CharSet = gbk ;";
Partially changed
SQLCHAR ConnStrIn [MAXBUFLEN] = "Driver = {Microsoft Access Driver (*. mdb)}; Dbq = // mydatabase. mdb; Uid = Admin; Pwd =; CharSet = gbk ;";
Dbq refers to the path strength of your database
Of course, you should create a database named mydatabase. mdb in c:/, and if the following SQL statement is written by the instructor
 
Result = SQLPrepare (hstmt, (SQLCHAR *) "insert into T_Person (FAge, FName) values (20, 'kiider ')", SQL _nt); www.2cto.com
 
In this case, you must create a T_Person table and two fields FAge and FName In the table. Otherwise, an error will occur.

Related Article

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.