Brief introduction to MySQLAPI programming _ MySQL

Source: Internet
Author: User
In MySQLAPI programming, m_ListBox is a ListBox control in the following code.

MYSQL * myData;

MYSQL_RES * myResult;

CString str;

MYSQL_ROW row;

Unsigned int num_fields;

Unsigned int I;

Unsigned long * lengths;

M_ListBox.ResetContent ();

ASSERT (m_ListBox.GetCount () = 0 );

If (myData = mysql_init (MYSQL *) 0 ))&&

Mysql_real_connect (myData, NULL, "root", NULL, NULL, MYSQL_PORT,

NULL, 0) // initialization, database connection, local connection, use root account, no password, default port

{

M_ListBox.AddString ("connection successful ");

If (myResult = mysql_list_dbs (myData, "%") // enumerate databases

{

M_ListBox.AddString ("enumeration database succeeded ");

Num_fields = mysql_num_fields (myResult); // number of data structures for obtaining results

While (row = mysql_fetch_row (myResult) // obtain the data of the next row

{

Lengths = mysql_fetch_lengths (myResult );

For (I = 0; I

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.