当前位置: 技术问答>linux和unix
LINUX Mysql编程问题,用的是C!!!!!!!等你!!!!!!!!!
来源: 互联网 发布时间:2016-02-16
本文导语: #include #include #include #include //void ExcuteSQL(char *strsql);//执行SQL语句函数 //void SelectTable( int main(){ MYSQL *mysql; MYSQL_RES *res; MYSQL_ROW row; char *query; int t,r; mysql_int(mysql); if(!mysql_real_connect(mysql,"127.0.0.1","mysql","mysql","deneme",0,NU...
#include
#include
#include
#include
//void ExcuteSQL(char *strsql);//执行SQL语句函数
//void SelectTable(
int main(){
MYSQL *mysql;
MYSQL_RES *res;
MYSQL_ROW row;
char *query;
int t,r;
mysql_int(mysql);
if(!mysql_real_connect(mysql,"127.0.0.1","mysql","mysql","deneme",0,NULL,0))
{
printf("ERROR CONNECTINT TO DATABASE: %sn",mysql_error(mysql));
}
else printf("Connect Successfully!n");
query="select * from deneme";
t=mysql_real_query(mysql,query,(unsigned int)strlen(query));
if(t)
{
printf("Error making query:%s n",mysql_error(mysql));
}
else printf("query make..n");
res=mysql_use_result(mysql);
for(r=0;r