cÓïÑÔÈçºÎÁ¬½ÓMYSQL£¿
´ó¼ÒºÃ:
ÎÒÊǸãCµÄ, ÏÖÔÚÏëÓÃC Á¬½ÓMYSQL,µ«ÊÇÔõôҲÁ¬½Ó²»ÁË,ÎҵĴúÂëÈçÏÂ:
#include <stdio.h>
#include "C:\Program Files\MySQL\MySQL Server 5.0\include\mysql.h"
int main()
{
MYSQL* mysql_a;
mysql_a = mysql_init(NULL);
if(mysql_a == NULL)
{
printf("init mysql failed\n");
return ER_BAD_DB_ERROR;
}
if (mysql_real_connect(mysql_a, "localhost", "root" , "123456", "lqiuiw",0, NULL, 0) == NULL)
{
printf("Failed to connect to database: Error: %u(%s)\n", mysql_errno(mysql),mysql_error(mysql));
mysql_close(mysql);
mysql = NULL;
return ER_BAD_DB_ERROR;
}
return 0;
}
³öÏֵĴíÎóÊÇ:
--------------------Configuration: sdfs - Win32 Debug--------------------
Compiling...
sdfs.c
c:\program files\mysql\mysql server 5.0\
Ïà¹ØÎÊ´ð£º
Ä¿Ç°Óöµ½µÄÎÊÌâÊÇ£º
´æ·ÅÔÚÔ¶³Ì·þÎñÆ÷¶Ëc/s³ÌÐòÒ»ÓиüУ¬ÈçºÎ×öµ½¿Í»§¶ËÁ¢¼´ÏìÓ¦µ¯³öÓÐ×îÐÂÉý¼¶µÄÌáʾ´°¿Ú¡£
±¾À´Óеã˼·£º²ÉÓÃWCF+windowns·þÎñ+¶¨Ê±Æ÷µÄ·½Ê½Ò²ÄÜʵÏÖ£¬µ«ÊÇÿ̨¿Í»§¶Ë»ú×Óÿ¸ô¶¼È¥·ÃÎÊÒ»ÏÂÔ¶³Ì ......
ÇëÎʸ÷λ¸ßÊÖÈçºÎÓÃC/C++»ñµÃϵͳδ°²×°²¹¶¡
ºÃÏñºÜרҵµÄ¶«Î÷¡£¡£¡£
²é×¢²á±í
ÿ¸ö²¹¶¡Èç¹û°²×°Á˶¼»áÔÚ×¢²á±íÀïÃæµÇ¼Ç
ÇëÎÊÄܲ»ÄܸüÇåÎúЩ£¬ÎÒÏëÓÃc\c++²é³öÀ´£¬²»ºÃÒâ˼£¬ÎÒÊÇÐÂÊÖ¡£»¹ÍûÖ¸½Ì¡£Ð»
·ÖÖµ ......
ÎÊÌâ:¹¤µØÉÏÐèÒª³¤¶ÈΪA1µÄ¸Ö½îX¸ù,³¤¶ÈΪA2µÄ¸Ö½îY¸ù,³¤¶ÈΪA3µÄ¸Ö½îZ¸ù......ÒÔ´ÎÀàÍÆ.
ÆäÖÐA1,A2,A3,...³¤¶ÈÈÎÒâÖ¸¶¨,X,Y,Z,...ÊýÁ¿Ò²ÈÎÒâÖ¸¶¨.
µ«²Ö¿âÖеĸֽîΪ±ê×¼³¤¶È,Ö»ÓÐ9Ã׺Í15Ã×Á½ÖÖ³¤¶È,ÊýÁ¿² ......
×î½üÔÚ¿´Ò»¸öÓÃbisonʵÏÖµÄC parser,OSÊÇopensolaris¡£µ±ÓÃËüÀ´½âÎöÒ»¸ö¼òµ¥µÄhello.cʱ£¬³öÏÖ¡°/usr/include/sys/va_list.h: parse error before __gnuc_va_list¡±¡£´ò¿ªÎļþva_list.hºó·¢ÏÖÕâÑùÒ»ÐС°typedef __bu ......
ÎÒÊÇÓÃmysql×Ô´øµÄC API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))
{
AfxMessageBox("Êý¾Ý¿âÁ¬½Óʧ°Ü") ......