PDA

View Full Version : problem with SQLite


Jonas DK
01-09-2007, 11:10 AM
Hi I keep getting an SQL error and I can't figure out what the problem is.

I tried deleting the query and copying one I know work but I still get the error.

The application last error is:
[47]: SQLite.Query(db, "CREATE TABLE tPostnrBy(ID integer primary key, Postnr text, By text)", nil);
TRACE: LastError = 30001 ("SQL logic error or missing database")
All the other tables are created with out problems.

The code I used is this:
db = SQLite.Open(Shell.GetFolder(SHF_MYDOCUMENTS).."\\ScRun.dat");

SQLite.Query(db, "CREATE TABLE tMedlem(ID integer primary key, CPR text, Fornavn text, Efternavn text, Adresse text, Postnr text, Enhed text)", nil);
SQLite.Query(db, "CREATE TABLE tData(ID integer primary key, CPR text, Parent text, Tel1 integer, Tel2 integer, Tel3 integer, Email text, Car text, Foto text, Notat text, Indmeldt, Udmeldt)", nil);
SQLite.Query(db, "CREATE TABLE tBetaling(ID integer primary key, CPR text, Betaling text)", nil);
SQLite.Query(db, "CREATE TABLE tPostnrBy(ID integer primary key, Postnr text, By text)", nil);
SQLite.Query(db, "CREATE TABLE tEnhed(ID integer primary key, Navn text)", nil);
SQLite.Query(db, "CREATE TABLE tFoto(ID integer primary key, Navn text)", nil);
SQLite.Query(db, "CREATE TABLE tCar(ID integer primary key, Navn text)", nil);


Can someone see what the problem is?

Cheers,
Jonas:huh

Dermot
01-09-2007, 11:18 AM
"By" is a reserved word in SQLite. http://www.sqlite.org/lang_keywords.html

Try naming that field something else.

Jonas DK
01-09-2007, 11:37 AM
"By" is a reserved word in SQLite. http://www.sqlite.org/lang_keywords.html

Try naming that field something else.

Of couse it is.

Thats the problem with not working in the native language of english.

I'll just replace By with City as that is what it means in danish.

Cheers and thanks for the quick help.


Jonas