mysql-MySQL如何用C++通过函数把变量录入到数据库中

php中文网
发布: 2016-06-06 09:33:29
原创
1364人浏览过

mysqlc++数据库

以下是关键代码

 /*        for (int i = 1; i <= n; i++)        {            res = mysql_query(&myCont, "INSERT INTO `i` (`id`, `name`, `age`, `subject`, `score`) VALUES ('3', 'C', '12', '英语', '100')");//查询          }        */   //模板        for (int i = 1; i <= n; i++)        {            int id; /*char name[10]*/; int age; /*char subject[10]*/; int score; string name; string subject;            cout << "intput id:"; cin >> id; cout << endl;            cout << "input name:"; getline(cin, name);            cout << "intput sge:"; cin >> age; cout << endl;            cout << "input subject:"; getline(cin, subject);            cout << "intput score:"; cin >> score; cout << endl;            res = mysql_query(&myCont, "INSERT INTO `i` (`id`, `name`, `age`, `subject`, `score`)VALUES (id, 'name', age, 'subject', score)");            //VALUES('3', 'C', '12', '英语', '100')");//查询          }
登录后复制

res = mysql_query(&myCont, "INSERT INTO i (id, name, age, subject, score)VALUES (id, 'name', age, 'subject', score)");
现在问题就是这句怎么改

c++速学教程(入门到精通)
c++速学教程(入门到精通)

c++怎么学习?c++怎么入门?c++在哪学?c++怎么学才快?不用担心,这里为大家提供了c++速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号