根据网上的资料
用C API的
在设置里面加入了libmysql.lib会出现(LIBMYSQL.DLL): 0xC0000005: Access Violation.想请问下达人..要怎么解决呢?...
解决方案 »
- 在MFC中哪个类可以绑定Picture Control
- 控件显示问题!
- 哪位大虾帮忙看看关于服务的问题
- 关于BoundsChecker的使用问题
- 一个工程中调用外部类~~
- vc操作oracle9i数据库,插入缓慢问题,请解决!
- JIMUWORD::JIMUWORD(CWnd* pParent /*=NULL*/): CDialog(JIMUWORD::IDD, pParent)
- 用VC开发的对话框中有一个edit box控件,显示数据库中的datetime类型的字段时出了问题
- 请问如何安装Microsoft Visual Studio.net(六张装)?
- directshow vs2010 编译出现 LNK2001
- vector ?
- 关于变量的声明?
#include <string.h>
#include <winsock2.h>
#include "mysql.h"#pragma comment(lib,"libmySQL.lib")把libmySQL.lib拷贝到程序目录
使用ADO连接上去的.
也可以使用.你这里这样做不知道你是使用什么东西.
#include <string.h>
#include <winsock2.h>
#include "mysql.h"#pragma comment(lib,"libmySQL.lib")void main(){
MYSQL *mysql;
MYSQL_RES *res;
MYSQL_ROW row;
char *query;
int t,r;
mysql=mysql_init(mysql);
if (!mysql_real_connect(mysql,"localhost","root","","ceshi",0,NULL,0))
{
printf( "Error connecting to database: %s\n",mysql_error(mysql));
}
else
printf("Connected...\n"); query="Insert Into admin(username,password) values('whoami','iampf')";
t=mysql_real_query(mysql,query,(unsigned int)strlen(query));
if(t)
{
printf("Insert Error:%s\n",mysql_error(mysql));
} query="select * from admin";
t=mysql_real_query(mysql,query,(unsigned int) strlen(query));
if (t)
{
printf("Error making query: %s\n",
mysql_error(mysql));
}
else printf("Query made...\n");
res=mysql_use_result(mysql);
for(r=0;r<mysql_field_count(mysql);r++){
row=mysql_fetch_row(res);
if(row<0) break;
for(t=0;t<mysql_num_fields(res);t++){
printf("%s ",row[t]);
}
printf("\n");
}
mysql_close(mysql);
}