VC++ Á¬½ÓMySQL Êý¾Ý¿â
°Ñmysql.h¸´ÖƵ½vcµÄĿ¼µÄincludeĿ¼ÏÂ
mysql.hÔÚÄãmysqlµÄ°²×°Ä¿Â¼ÏµÄincludeÀïÃæÈç:mysql\include
°Ñlibmysql.lib(ÔÚmysqlµÄ°²×°Ä¿Â¼Ï£¬ËÑË÷ϾÍÄÜÕÒµ½£©¸´ÖƵ½Õâ¸öĿ¼Ï£¨C:\Program Files\Microsoft Visual Studio 9.0\VC\lib£©£¬Òª²»Á¬½Ó»á³ö´í¡£
Èç¹û±àÒëÁ¬½Óʱ»¹Êdzö´í¡£¾Í°Ñlibmysql.lib¸´ÖƵ½ÄãÔ´³ÌÐòµÄĿ¼ÖÐ
£¨Ê¾Àý1)¡¢
// TODO: Add your control notification handler code here
char *query;
int t,r;
MYSQL_RES *res;
MYSQL_ROW row;
m_mysql = mysql_init(NULL);
if (!mysql_real_connect(m_mysql,"localhost","databasename",
"yourdatabase-password","yourtable",0,NULL,0))
{
CString errors =mysql_error(m_mysql);
MessageBox(errors,"´íÎó");
}
query="select text from yourtable";
t=mysql_real_query(m_mysql,query,(unsigned int) strlen(query));
if(t)
{
MessageBox(mysql_error(m_mysql));
}
res=mysql_use_result(m_mysql);
row=mysql_fetch_row(res);
CString sumstr;
for(r=0;r<=mysql_field_count(m_mysql);r++)
{
if(row<0)
{
MessageBox("error");
}
for(t=0;t<mysql_num_fields(res);t++)
{
CString Query = row[t];
sumstr+=Query+" ";
}
}
MessageBox(sumstr);
mysql_close(m_mysql);
}
£¨Ê¾Àý2£©¡¢
#include "winsock.h"
#include "mysql.h"
int main(int argc, char* argv[])
{
MYSQL * con = mysql_init((MYSQL*) 0);
LPSTR host = "***";
LPSTR user,psw,dbname,;
if ( con !=NULL
&& mysql_real_connect(con,host,user,psw,dbname,3306,NULL,0) )
{
if (!mysql_select_db(con,dbname))
{
printf("Select successfully the database!\n");
con ->reconnect = 1;
if (!mysql_query(con,"select * from table_name"))
{
printf("Show table---orders:\n");
MYSQL_RES * recordSet = mysql_store_result(con);
long j = mysql_num_fields(recordSet);
long i = (long)mysql_num_
Ïà¹ØÎĵµ£º
ÓÉÓÚ³ÌÐòÔËÐÐʱռÓõÄÄÚ´æ¹ý´ó£¬ËùÒÔÏë°ì·¨¸ø³ÌÐòÊÝÉí¡£
ÔÚµ÷ÊÔÖз¢ÏֽṹÌåÕ¼ÓõÄsize¾¹È»ºÍÔ¤ÏëµÄ²»Ò»Ñù£¬ÔÀ´……
¿´¿´ÏÂÃæ½²µÄ°É£¬¿Ï¶¨»á²»Í÷´Ë¿´Å¶£¡
1,±ÈÈç:
struct{
short a1;
short a2;
short a3;
}A;
struct{
......
ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Ñ§Ï°ÈçºÎͨ¹ýPHP 5µÄÒ»¸ö»ù±¾³éÏóÀàʹÓÃÍâ¼üÔ¼ÊøÀ´¸üÐÂÁ½¸öInnoDB±íµÄÊý¾Ý¡£ ÎÒÃǽ«Í¨¹ý¾ßÌåʾÀýÀ´ËµÃ÷ÈçºÎͨ¹ý·þÎñÆ÷¶Ë½Å±¾ÓïÑÔÀ´Ê¹ÓÃÍâ¼üÔ¼Êø¡£
¡¡¡¡Ò»¡¢ÀûÓÃÍâ¼üÔ¼Êø¸üÐÂMySQLÖеÄÊý¾Ý
¡¡¡¡ÏÖÔÚ£¬×îÁ÷ÐеĿªÔ´¹ØϵÐÍÊý¾Ý¿â¹ÜÀíϵͳ·ÇMySQLĪÊô£¬¶øMySQLÓÖÖ§³Ö¶à¸ö´æ´¢ÒýÇ棬ÆäÖÐĬÈϵÄÒ²ÊÇËٶȽϿìµÄ´ ......
import java.util.concurrent.Semaphore;
/**
* ³éÏóÈÎÎñ£¬¾ßÌåµÄÖ´ÐÐÈÎÎñ£¬¹éʵÏÖÀฺÔð
*
* @author Administrator
*
*/
public abstract class Task {
public abstract void run();
private Semaphore s;
private boolean hasExisted = false;
public void P(final Semaphore s) throws Interrupt ......
Ðè×¢ÒâÒÔÏÂÈýµã£º
1¡¢´´½¨Êý¾Ý¿âµÄʱºò£ºCREATE DATABASE `database`
CHARACTER SET 'utf8'
  ......