mysql编程中的问题。。。。。。。。
小弟初学MySQL 编程 用MySQL中提供的C API 写个简单的连接到mysqlserver 的问题 代码是从mysql帮助手册里 找来的
介绍的mysql_real_connect 这个函数的 代码如下
C/C++ code:
#include <mysql.h>
#include <stdio.h>
int main()
{
MYSQL mysql;
mysql_init(&mysql);
mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"your_prog_name");
if (!mysql_real_connect(&mysql,"host","user","passwd","database",0,NULL,0))
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",mysql_error(&mysql));
}
}
出现的错误 很多 错误如下
mysql server 6.0\include\mysql_com.h(268) : error C2061: syntax error : identifier 'SOCKET'
mysql server 6.0\include\mysql_com.h(304) : error C2059: syntax error : '}'
mysql server 6.0\include\mysql_com.h(418) : error C2143: syntax error : missing ')' before '*'
mysql server 6.0\include\mysql_com.h(418) : error C2143: syntax error : missing '{' before '*'
mysql server 6.0\include\mysql_com.h(418) : error C2371: 'Vio' : redefinition; different basic types
mysql server 6.0\include\mysql_com.h(254) : see declaration of 'Vio'
mysql server 6.0\include\mysql_com
相关问答:
先上错误
无法联接数据库
java.sql.SQLException: Before start of result set
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java: ......
大家帮我看下吧,本来数据库没有东西,能显示没有东西的信息,但是我添加了一条内容后,字没了,但是图片也无法显示,红叉叉也没有,怎么回事啊?
PHP code:
<?php
$str="select * from product wh ......
我在清理mysql的时候,一不留神将mysql(即data里的mysql文件夹)数据库给删掉了,隔了几个小时我重启了mysql软件,mysql就自动初始化了数据库,导致从删除mysql文件夹开始到重启这段时间的数据丢失,那位高手帮想想办 ......
表
CREATE TABLE `ch1` (
`id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
`no` int(10) unsigned DEFAULT NULL,
`dtime` datetime DEFAULT NULL,
PRIMARY KEY (`id ......