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

ÔÚVC6ÖÐʹÓÃc API·½Ê½Á¬½ÓMySQLÊý¾Ý¿â

ÔÚVC6ÖÐʹÓÃc API·½Ê½Á¬½ÓMySQLÊý¾Ý¿â
Ò»¡¢»·¾³ÅäÖÃ
1¡¢ÔÚMySqlµÄ¹Ù·½ÍøÕ¾ÏÂÔØmysql-connector-c-noinstall£¬²¢½«½âѹºóµÄbinºÍincludeÎļþ¼Ð¿½±´µ½MysqlµÄ°²×°Ä¿Â¼
2¡¢ÉèÖÃVC6»·¾³£¬ÔÚvc¹¤¾ß-Ñ¡Ïî-Ŀ¼£¬¼ÓÈë¸Õ²ÅµÄIncludeÎļþ¼ÐµÄ·¾¶£¬ÀýÈ磺C:\Program Files\MySQL\MySQL Server 5.1\include
¶þ¡¢¹¤³ÌÉèÖÃ
3¡¢½«libÎļþ¼ÐÖеÄlinmysql.libºÍlibmysql.dll¿½±´µ½¹¤³ÌĿ¼Ï£¬¹¤³Ì-ÉèÖÃ-Á¬½Ó£¬ÔÚ¶ÔÏó/¿âÄ£¿éÖÐÌí¼Ówsock32.libºÍlibmysql.lib
Èý¡¢Ê¾Àý
4¡¢Ïȵ¼Èë²âÊÔ³ÌÐòËùÐèµÄ»·¾³£¬½«ÒÔÏÂSQLÓï¾ä±£´æΪsql½Å±¾Îļþ²¢µ¼Èë
#VC6ͨ¹ýAPIÁ¬½ÓMysql²âÊÔ»·¾³
#´´½¨Êý¾Ý¿â
drop database if exists `test`;     #Èç¹ûÓÐÕâ¸öÊý¾Ý¿â£¬ÔòÒƳýËü create database test;               #´´½¨Êý¾Ý¿â
use test;           #ʹÓÃÊý¾Ý¿â
#´´½¨±íUser£¬±£´æ»áÔ±ÊôÐÔ
drop table if exists `User`;
create table User (
    id int(11) not null auto_increment,
    name varchar(20),
    age int(11),
    primary key (id)
);
#²åÈëһЩÊý¾Ý
insert into user values (NULL, 'name1', 11);
insert into user values (NULL, 'name2', 22);
insert into user values (NULL, 'name3', 33);
5¡¢²âÊÔ´úÂë
#include <windows.h>
#include <mysql.h>
#include "stdio.h"
MYSQL mysql, *sock; //mysqlÁ¬½Ó
MYSQL_RES *res; //Õâ¸ö½á¹¹´ú±í·µ»ØÐеÄÒ»¸ö²éѯ½á¹û¼¯
MYSQL_ROW row; //Ò»¸öÐÐÊý¾ÝµÄÀàÐÍ°²È«(type-safe)µÄ±íʾ
char query[150]; //²éѯÓï¾ä
bool ConnectDatabase(); //º¯ÊýÉùÃ÷
void FreeConnect();
bool QueryDatabase();
bool InsertData();
int main()
{
ConnectDatabase();
QueryDatabase();
InsertData();
QueryDatabase();
FreeConnect();
return 0;
}
//Á¬½ÓÊý¾Ý¿â
bool ConnectDatabase()
{
//³õʼ»¯mysql
mysql_init(&mysql); //Á¬½Ómysql£¬Êý¾Ý¿â
if (!(sock = mysql_real_connect(&mysql,"localhost", "root", "root", "test",0,NULL,0)))
{
printf( "Error connecting to datab


Ïà¹ØÎĵµ£º

cÓïÑÔ»ù´¡£¨ÊÇʱºò²¹²¹cµÄ»ù´¡ÁË£©

¿´Êý¾Ý½á¹¹ñÍÕ»µÄʱºòдÁËÕâôһ¶Î´úÂë
#include<stdio.h>
#include<stdlib.h>
struct linkstack
{
int data;
struct linkstack *next;
};
int initstack(linkstack * S)
{
S = (linkstack *)malloc(sizeof(linkstack));
if(S == NULL) return 0;
S->next = NULL;
return 1;
}
int main(int ......

C/C++Éî²ã̽Ë÷

Ò»¡¢
1¡¢¹ØÓÚ×Ö½Ú˳Ðò£º»°ËµÔÚÌض¨µÄÓ²¼þƽ̨ÉÏ£¬¶à×Ö½ÚÊý¾ÝµÄ˳Ðò´æ·ÅÓÐÁ½ÖÖ·½Ê½£¨little-endian¡¢big-endian£©¡£Ç°ÕßµÄÊý¾ÝµÄµÍ×Ö½Ú
     ²¿·Ö´æ·ÅÔڵ͵ØÖ·Äڴ棬ºóÕßÇ¡ºÃÏà·´¡£PCÒ»°ãÊÇ»ùÓÚIA-32΢´¦ÀíÆ÷£¬ÊôÓÚlittle-endian¡£Ä³Ð©RISC¼Ü¹¹µÄCPU£¬ÀýÈçSPARC¡¢
    POWERPCµÈ£¬ÔòÊ ......

mysqlÔÚÔÙ´ÎжÔغóÖØ×°³öÏÖStart services²»ÄÜÆô¶¯

    ×î½ü×öÒ»¸öСÏîÄ¿£¬¸ÕºÃÓöµ½Õâ¸öÎÊÌ⣬ûʲôʱ¼äÈ¥½â¾öÕâ¸öÎÊÌ⣬´ó¸ÅÔÚÍøÉÏÕÒÁËһϣ¬Ëµ¸ÄʵÀýÃû£¬¸Ä×¢²á±í£¬ÏȲ»ÊǺܸҸģ¬±Ï¾¹¶Ô×¢²á±íÒ»Ö±¾õµÃÊǸö´óÉñ£¬²»¸ÒËæ±ã¶¯£¬½ñ¶ùÊÇ»í³öÈ¥ÁË£¬¾ÍÔÚ×¢²á±íÖвéÕÒËùÓдúmysql×ÖÑùµÄÐÅϢȫ²¿É¾³ý£¬×îºó¾¹È»³ÉÁË£¬µ±È»Ð¶Ôغóɾ³ý֮ǰËùÓеÄÏà¹ØÐÅÏ¢£¬°²×°ÎļþÄ¿ ......

ÃæÊÔ¹éÀ´£¬Îʼ¸µÀÅ£±ÆUNIX C/C++±ÊÊÔÌâ

1¡¢´ÓN¸öÊýÖÐÑ¡³ön¸ö×î´óµÄÊý£¬Ð´³ö˼·ºÍʵÏÖ¡£
¡¶±à³ÌÖ®ÃÀ¡·ÉÏÓн²Õâ¸öËã·¨µÄÉè¼ÆÓë˼·¡£
ÎÒÕâÀï¼òµ¥Ð´¼¸¸ö˼·£º
£¨a£©Èç¹ûNÄÜÔÚÖ÷´æÖÐÒ»´Î¶ÁÈ룬ÔòÏȽøÐпìÅÅ£¬È»ºóÔÙÈ¡Ç°n¸öÊý¡£Ëã·¨¸´ÔӶȣºO(NlogN).
£¨b£©Èç¹ûN·Ç³£´ó£¬¼ÙÉè²»ÄÜÒ»´Î¶ÁÈëÄڴ棬²¢ÇÒn²»ÊǺܴóµÄ»°£¬¿ÉÒÔά»¤Ò»¸ön¸öÔªËصÄÓÐÐò¶ÓÁУ¬¶ÓÁÐÖж¼ÊÇÿ¸ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ