Hi there, I am new to programming with databases and I have created a test database using SQLite. I created an if statement which calls to a label to identify whether the database is connected. It says its connected but does not display the values within DBGrid. If anyone can help I would be most grateful.
Here is the code I have written below........
procedure TfrmSqliteTest.ConnectButtonClick(Sender: TObject);
begin
SQLite3Connection1.DatabaseName := 'sqltest.db';
SQLite3Connection1.Transaction := SQLTransaction1;
SQLTransaction1.Database := SQLite3Connection1;
SQLQuery1.Database := SQLite3Connection1;
SQLQuery1.Transaction := SQLTransaction1;
SQLQuery1.SQL.Text := 'SELECT * FROM Person';
Datasource1.dataset := SQLQuery1;
DBGrid1.Datasource := DataSource1;
SQLite3Connection1.Open;
If SQLite3Connection1.Connected then
begin
Connect.caption := 'Connected';
end;
end;