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

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_


Ïà¹ØÎĵµ£º

mysqlºÍsqlserverÖв鿴µ±Ç°¿âÖÐËùÓбíºÍ×Ö¶ÎÐÅÏ¢

>>mysql:
1¡¢²é¿´ËùÓбíÃû£º
show tables [from db_name];
2¡¢²é¿´×Ö¶ÎÐÅÏ¢
SHOW FULL COLUMNS from db_name.table_name
»ñÈ¡ÒÔÏÂÐÅÏ¢
Field £º×Ö¶ÎÃû
Type£º×Ö¶ÎÀàÐÍ
Collation£º×Ö·û¼¯ £¨mysql 5.0ÒÔÉÏÓУ©
Null £ºÊÇ·ñ¿ÉÒÔΪNULL
Key£ºË÷Òý£¨PRI,unique,index)
Default£ºÈ±Ê¡Öµ
Extra£º¶îÍ⣨ÊÇ·ñ aut ......

mysql forige key


Love in coding...
    Free and Susan
[Òý]MySQL INNODBÀàÐͱíµÄÍâ¼ü¹ØÁªÉèÖÃ

Here is a simple example that relates parent and child tables through a single-column foreign key:
CREATE TABLE parent (id INT NOT NULL,
          ......

C/C++ÓÚJavaÖ®¼äµÄ»¥Ïàµ÷ÓÃ

ÀûÓÃJNI¼¼Êõ£¬¿ÉÒÔ×öµ½C/C++ÓëJavaÖ®¼äµÄÏ໥µ÷Óá£
1¡¢Javaµ÷ÓÃC/C++½Ó¿Ú
Õâ¸öÊÇJNI×î»ù±¾µÄÓ¦Óã¬JNIÓкܶàÕâ·½ÃæµÄÀý×Ó´úÂë¡£Ò»°ã°ÑC/C++д³É¶¯Ì¬Á´½Ó¿â£»ÔÚJava³ÌÐòÔÚLoadLibrary£¬ÀûÓÃnative½Ó¿Ú£¬¼´¿ÉÍê³Éµ÷Óá£
2¡¢C/C++»Øµ÷Java½Ó¿Ú
ÕâÖÖÓ÷¨£¬JNIµÄÀý×ӱȽÏÉÙ¡£Æäʵ£¬Ò²±È½Ï¼òµ¥£¬JNIÒ²ÌṩÁËÕâÑùµÄ½Ó¿Ú¡ ......

C/C++ÖÐÔ¤±àÒë#,##,#error£¬#pragma×÷ÓÃ


#
ÊÇÉú³É×Ö·û´®£º
          #define a(x) #x
          a(bc
) => "bc"
##
ÊÇÁ¬½Ó£º
          #define a(x) abc##x
     &n ......

mysqlÖÐÎÄÂÒÂë½â¾ö

ÓÉÓÚÄÜÖ±½ÓÔÚMYSQLÊý¾Ý¿âÀïÌí¼ÓÖÐÎÄÊý¾Ý,²¢ÇÒÄÜÕý³£ÏÔʾ,˵Ã÷ÎÒµÄ±í¶¼Ê¹ÓÃÁËÕýÈ·µÄ×Ö·û±àÂë,¾­¹ý²é¿´ºó,È·ÈÏÁË,ÎÒÈ«²¿µÄ±íÒÔ¼°×ֶζ¼Ê¹ÓÃÁËUTF-8µÄ±àÂë,µ«ÊÇΪʲô³ÌÐòÌí¼ÓµÄÖÐÎÄÊý¾Ý¾Í²»ÐÐÄØ?
Æäʵ,Ô­ÒòÔÚÓÚMYSQL·þÎñÆ÷ʹÓõÄĬÈϱàÂë,ÒÔ¼°Êý¾Ý¿âµÄĬÈϱàÂë,ºÜ¶àÈËÒѾ­ºÜСÐĵÄÔÚ½¨Á¢±íʱ¹Ø×¢±íµÄ×Ö·û±àÂë,È´ºöÂÔÁËÊý¾Ý¿â ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ