¹ØÓÚc++¹ÜÀímysqlµÄº¯ÊýÎÊÌ⣨¼±£©
Èç¹ûÎÒÏëÓÃselect * from mytable where ×Ö¶Î1= and ×Ö¶Î2= and ×Ö¶Î3=
ÆäÖÐ×Ö¶Î1£¬2£¬3¶¼ÒªÇó´ÓÒѶ¨ÒåµÄ±äÁ¿ÖÐÈ¡£¬ÒªÔõô×ö£¿
sprintfºÍmysql_queryËÆºõ¶¼²»Ðа¡ Çë¸÷λ°ï°ïæ
Èç¹û¶¼ÊÇÓñäÁ¿,¿ÉÒÔʹÓÃstl::map½â¾ö
map <string,string> m_data;
m_data["id"]="123456";
È»ºóʹÓõü´úÆ÷¹¹ÔìsqlÓï¾ä.
string query="select * from mytable where ";
map <string,string>::iterator it=m_data.begin();
while(it!=m_data.end()){
query+=it->first;
query+="=";
query+=it->second;
it++;
}
²»ÖªµÀÊDz»ÊÇÄãÏëҪʵÏֵŦÄÜ.
char szSqlText[500];
sprintf(szSqlText,"select * from anchorid where xdid=%d and pointid=%d and xdupdw='up'",xd_id,anchorid1);
mysql_query(sock,szSqlText);
ÎÒÓõÄÕâ¸ö£¬Ð´µÄÓ¦¸Ã¶Ô°É£¬ ¿É»¹ÊDz»Ðа¡ acmain´ó¸çÔÙ°ï°ï棬ÎÒ¾ÍÊÇÒªÓÃÕâÖÖÓï¾äʵÏÖµÄ
looyaoµÄºÃÏñºÜ¸´ÔÓ£¬ÎÒ¿´²»¶® ¹þ ÎÒÊDzËÄñ
char szSqlText[500];
sprintf(szSqlText,"select * from anchorid where xdid=%d and pointid=%d and xdupdw='up'",xd_id,anchorid1);
printf("%s",szSqlText);
mysql_query(sock,szSqlText);
¿´Ò»ÏÂÄãµÄSQLÓï¾äÊÇʲô£¿
ÁíÍâ½
Ïà¹ØÎÊ´ð£º
C\C++ÈçºÎ¼ÆË㺯ÊýµÄµ¼Êý,±¾ÈËÐÂÊÖ£¬Ïëд¸ö³ÌÐò£¬µ«ÊDz»ÖªµÀÈçºÎÏÂÊÖ£¬»¹Íû¸ßÊÖÖ¸µãÒ»¶þ£¬Ð»¹ý¡£
Õâ¸ö¡¡
¸úº¯ÊýµÄ¾ßÌåÐÎʽÓйذɣ¬ÄѵÀÄãÏë±à³ö¸ö¡°ÍòÄÜ¡±µÄÇ󵼺¯Êý£¿
°³ÉÏѧʱÏë¹ý×Ô¶¯ÍƵ¼¹«Ê½£¬ºóÀ´ ......
±àÒëÆ÷£ºC-Free4
mysql µ¥¶À°²×°µÄ£¬ÏÖÔÚΪapache+php+mysql¿ÉÒÔʹÓá£
×î½üÔÚÁ·Ï°c£¬c++£»ÏëÓÃc£¬c++Á¬½ÓÏÂÎÒµÄmysql£¬ºÃ¶àµØ·½¶à˵mysql.hÕÒ²»µ½¡£¶øÇÒÎÒmysqlûÓÐËùνµÄincludeÎļþ¼Ð°¡¡£
Íü¸ßÊÖÖ¸µãÒ»¶ ......
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ÎÒÒÔǰ°²×°ÁËÒ»´Î£¬ºóÀ´Ð¶ÔØÁË£¬ÏÖÔÚÔÙ°²×°µÄʱºò£¬Ìáʾ´íÎó£º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.
¿ ......
ÎÒÓÐÒ»¸öjava»·¾³ÏµijÌÐò£¬ÔÚ±¾»úÔËÐÐÕý³££¬µ«·¢²¼µ½ÍøµÄÐéÄâÖ÷»úʱ²»ÄÜÁ¬½ÓÊý¾Ý¿âÁ¬½Ó³Ø
jdk 1.6 tomcat6.0.18 mysql5 mysqljdbc5.1.5
ÐéÄâÖ÷»úµÄ¼¼ÊõÈËԱ˵£¬Ö»ÄÜÅäÖþÖÓòµÄÊý¾Ý¿âÁ¬½Ó³Ø£¬Ò²¾ÍÊÇÔÚM ......