01-27-2012, 04:57 AM
not tested
Member function Sqlite.ToQmGrid2
Member function Sqlite.ToQmGrid2
function hgrid $sql [flags] ;;flags: 1 except first column, 2 append
;Populates QM_Grid control with data from database.
;Error if something fails, eg if SQL is incorrect.
;Error if column count in query results is greater than grid column count minus flag 1.
;hgrid - QM_Grid control handle or DlgGrid variable.
;sql - SQL statement that selects data to be displayed in the grid. For example, "SELECT * FROM table1" displays whole table1.
;<open "sample_Grid_Sqlite">Example</open>
type ___SQLITEQG DlgGrid'g ncol firstcol nr ~es
___SQLITEQG x.g.Init(hgrid)
x.firstcol=flags&1
x.ncol=x.g.ColumnsCountGet-x.firstcol
if(flags&2) x.nr=x.g.RowsCountGet
else x.g.RowsDeleteAll(x.firstcol)
ExecF(sql &Sqlite_QgCallback &x)
err
,if(x.es.len) end x.es
,end _error