delphi - Trouble passing a string as a SQLite ExecSQL command -


i keep getting error: near "password": syntax error when trying execute execsql() statement. command looks in output of text file. in fact, copied & pasted command directly sqlite database browser , commend executed properly. here's code that's producing error:

procedure tform1.button1click(sender: tobject); var i, ifieldsize: integer;     sfieldname, sfieldtype, sfieldlist, sexecsql: string;     names: tstringlist;     f1: textfile; begin   //open source table - table1 has 8 fields has 2 different field types ftstring , boolean   table1.tablename:= 'pwfile';   table1.open;   //fdconnection1.execsql('drop table pwfile');   sfieldlist := '';   names := tstringlist.create;   := 0 table1.fieldcount - 1     begin       sfieldname := table1.fielddeflist.fielddefs[i].name;       sfieldtype := getenumname(typeinfo(tfieldtype),ord(table1.fielddeflist.fielddefs[i].datatype));       ifieldsize := table1.fielddeflist.fielddefs[i].size;       if sfieldtype = 'ftstring' sfieldtype := 'nvarchar' + '(' + inttostr(ifieldsize) + ')';       if sfieldtype = 'ftboolean' sfieldtype := 'integer';       names.add(sfieldname + ' ' + sfieldtype);       if sfieldlist = '' sfieldlist := sfieldname + ' ' + sfieldtype        else sfieldlist := sfieldlist + ', ' + sfieldname + ' ' + sfieldtype;     end;   listbox1.items.add(sfieldlist);   sexecsql := 'create table if not exists pwfile (' + sfieldlist + ')';   // 08/18/2014 - entered log sqlite fdconnection1.execsql command file   assignfile(f1, 'c:\users\test user\documents\sqlite_command.txt');   rewrite(f1);   writeln(f1, sexecsql);     { insert code here require flush before closing file }   flush(f1);  { ensures text written file }   closefile(f1);   fdconnection1.execsql(sfieldlist);   table1.close; end; 

here's actual command gets executed: create table if not exists pwfile (password nvarchar(10), passname nvarchar(10), dept nvarchar(10), active nvarchar(1), admin integer, shred integer, reports integer, maintain integer)

you not executing sexecsql sfieldlist.


Comments