Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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/C++ QQȺ - C/C++ / ·Ç¼¼ÊõÇø

QQȺ 29152388
ÓÑÇéUP

°ï¶¥

up

°ïup

up Ö§³Ö£¡

up jf

...ÄѵÀÓзÖ..?

up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£

Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ

¼ÓÁË¡£

¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......

̽Çó³öc£«+¡¢cµÄ֪ʶ

      ÏÖÔÚÓйØc++¡¢cµÄÊé¼®£¬ÄÇЩÊéÊǽÏÉî²ã´ÎµÄ£¿Çë½éÉܼ¸±¾£¿


#include <iostream>
using namespace std;
int funhion(int x, int y )
{
int m,n;
    ......

linux»·¾³ÏÂgethostbynameº¯ÊýÎÊÌâ - C/C++ / CÓïÑÔ

дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
   
  struct hostent *hp; 
char AlarmDevIP[20];  
  int x2;

hp = gethostbyname("www.google.com");
if (hp)
{ ......

mysqlµÄÁ¬½Ó³¬Ê±Ê±¼äÔõôÉèÖà - VC/MFC / Êý¾Ý¿â

ÎÒÊÇÓÃmysql×Ô´øµÄC API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))

AfxMessageBox("Êý¾Ý¿âÁ¬½Óʧ°Ü") ......

MYSQL°²×°Ê§°Ü

ÎÒÒÔǰ°²×°ÁËÒ»´Î£¬ºóÀ´Ð¶ÔØÁË£¬ÏÖÔÚÔÙ°²×°µÄʱºò£¬Ìáʾ´íÎó£ºError 1305.Error reading from file C:DOCUME~1\LOCALS~1\Temp\mysql_server.msi.Verify that the file exists and that you can access it.
¿ÉÊÇÎÒÕÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ