Topic: problems with basic select
hello !
first: congratulation to this product, it seems a lot easier to use than the lazarus internal sqlite components.
and i need the blob-support, this is on of the main reasons i try it out. :-)
* i use lazarus 0.9.29 (win32)
* sqlitepass 0.5.1
* my sqlite database was created with sqlite expert 3.0.33.2068, file ending is ".db3".
what i want:
1. i try to create a database and a dataset object in a simple unit, not a form.
2. connect to the database
3. make a query the the db
4. show the result in a grid.
5. close the database and free all ressources.
but i have a problem, i can´t figure out. i post my code, and please correct it at any location if it is not the "best practise" way for sqlitepass. had this code yesterday written, it was my first try.
// creating and connecting to the db
sqlDB:=TSqlitePassDatabase.Create(nil);
sqlCur:=TSqlitePassDataset.Create(nil);
sqlDB.Database:='ds_db.db3';
sqlDB.DatabaseType:=dbtSqliteExpert; // is this right / nessessary ?
sqlDB.Connected:=True;
sqlCur.Database:=sqlDB;
//quering
sSQL:='SELECT a.*, b.WeCl2_Name, c.WeCl1_Name '+
'FROM Weapons a '+
'INNER JOIN WeaponClassification2 b ON a.WeCl2_ID=b.WeCl2_ID '+
'INNER JOIN WeaponClassification1 c ON b.WeCl1_ID=c.WeCl1_ID '+
'ORDER BY c.WeCl1_Name, b.WeCl2_Name, a.We_Name;';
sqlCur.SQL.Text:=sSQL;
sqlCur.Open;
// no recordset-iteration, because of an easy example
showmessage( sqlCur.FieldByName('WeCl2_Name').AsString );
sqlCur.Close;
// closing and freeing objects. is this enogh?
sqlDB.Connected:=False;
sqlCur.Free;
sqlDB.Free;
it crashes on the line
>sqlCur.SQL.Text:=sSQL;
the message is: excepotion "EDatabase Error", "1: no such column: Weapons._RowID_"
have tried the rewrite the select without ".*"(naming all fields) ->same result.
the query is ok, works with sqlite expert and the lazarus sqlite-components.
what i have to do to correct this prolem?
thanks.
Last edited by Leberecht (2010-07-31 09:12:34)