先给个MYSQL对于C的API
具体代码,改为手动提交,每次5W数据
//mysql所需的头文件和库文件
大致说一下C链接MYSQL的方法:
1、去官方下载mysql和c的connector
2、拷贝里面的lib目录下的dll和lib文件到当前目录下
3、设置当前项目的头文件位下载的目录下的inlcude
4、设置一个lib库(在项目设置里),设置第2步的文件名
insert插入多条数据有二种方法一种是写多条insert 语句用";"号分割每条sql,一种是insert本身的多个value
1,写多条insert用";"分割
这个很简单,;号是mysql执行sql的结束符,写多个insert用;号割就是让mysql执行多次而已.比如:
insert into table (field1,field2,field3) value ('a',"b","c");
insert into table (field1,field2,field3) value ('a',"b","c");
insert into table (field1,field2,field3) value ('a',"b","c");
insert into table (field1,field2,field3) value ('a',"b","c");
insert into table (field1,field2,field3) value ('a',"b","c");
2,在insert中写多个value
INSERT INTO table (field1,field2,field3) VALUES ('a',"b","c"), ('a',"b","c"),('a',"b","c");
联系客服