我有这个:
// Get database access parameters const char* db = "codes",*server = "localhost",*user = "root",*pass = "pass"; // Connect to the sample database. MysqLpp::Connection conn(false); if (conn.connect(db,server,user,pass)) { for (int i=0; i<10; ++i) { int d,count; cout << "Введите D\n"; cin >> d; cout << "Введите количество записей при D=" << d << endl; cin >> count; for (int a=0; a<count; ++a) { char * name; int r,n1,n2; cout << "Введите R\n"; cin >> r; cout <<"Введите n1 и n2\n"; cin >> n1 >> n2; cout <<"Введите название\n"; cin >> name; MysqLpp::Query query = conn.query(); for (int j=n2-n1+1; j<n2; ++j) { int k =pow(2,(j+r)); query << "insert into code (n,k,d,name) values (" << j << "," << k << "," <<d<<"," << MysqLpp::quote_only << name << ");"; query.execute(); } } } conn.disconnect (); return 0; } else { cerr << "DB connection Failed: " << conn.error() << endl; return 1; } }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。