Help!
I've done everything I can think of to pass arguments to SQLite and nothing
is working. If anyone has information on how to do it, I'd appreciate it.
Here's a code segment:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include "util.h"
#include <sqlite3.h>
using namespace std;
int main (int argc, char **argv)
{
sqlite3 *db; // --- database
char *zErr;
int return_code;
char *sql;
// ----- variables for database input ---------------
char name[30];
int age;
// ----- create or open the database ----------------
return_code = sqlite3_open("Family.db", &db);
// ----- error creating or opening the database -----
if (return_code) {
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db); // --- close database
exit(1);
}
// ----- enter data into local variables ------
cout << "Enter name: "; cin.getline (name, 30);
cout << "Enter age: "; cin >> age;
// ----- enter a record into the database -----
sql = "insert into family (member,age) values (name, age)"; // --------
HERE'S WHERE COMPILE BUSTS
The error is that no column exists called 'age.' I've tried passing name
and age as pointers, as references, I've tried declaring them as pointers,
etc. and nothing can be passed. If I pass absolute arguments ("Nick", 30)
it works.
Again, I appreciate any and all help!
Regards,
Nick.
--
View this message in context:
http://www.nabble.com/Passing-Arguments-to-SQLite3-from-C%2B%2B-tf3548345.html#a9905633
Sent from the SQLite mailing list archive at Nabble.com.
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------