[Lazarus] Some information about DBNavigator and DBGrid single applications

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Thu Jul 28 08:11:41 CEST 2011


Ummm, that project uses Connection, Query and Transaction, which are
components which I never use. Are you sure that you need those more
complex components for your project?

I always use datasets, and your program worked fine for me when I
added the following TSqlite3Dataset:

  object Datasource1: TDatasource
    DataSet = Sqlite3Dataset1
    left = 512
    top = 176
  end
  object Sqlite3Dataset1: TSqlite3Dataset
    FileName = '/Users/felipe/Programas/testes_sqllite/dbteste'
    SaveOnClose = True
    TableName = 'teste'
    Active = True
    left = 426
    top = 41
  end

Note that the properties Active and SaveOnClose need to be set to
True. I also added two fields to the dataset of type unknown.

I build that following the instructions found here:

http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial#How_To_Use_.28Basic_Usage.29

Clearly something is missing to save the database in the original
example. Here is the connection components layout in case someone
wants to see without downloading the 7z file:

  object SQLite3Connection1: TSQLite3Connection
    Connected = True
    LoginPrompt = False
    DatabaseName = 'c:\temp\dbteste'
    KeepConnection = False
    Transaction = SQLTransaction1
    LogEvents = []
    Options = []
    left = 512
    top = 64
  end
  object SQLQuery1: TSQLQuery
    Database = SQLite3Connection1
    Transaction = SQLTransaction1
    ReadOnly = False
    SQL.Strings = (
      'select * from teste'
    )
    Params = <>
    left = 512
    top = 120
  end
  object SQLTransaction1: TSQLTransaction
    Active = True
    Action = caNone
    Database = SQLite3Connection1
    left = 512
    top = 240
  end

-- 
Felipe Monteiro de Carvalho




More information about the Lazarus mailing list