"unable to retrieve fields definition from dataset."
Hello and thank you for your responses.
The code isn't very exciting I'm afraid
[nobbc][code]
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, sqlite3conn, sqldb, db, FileUtil, Forms, Controls,
Graphics, Dialogs, DbCtrls, DBGrids, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
dsMembers: TDataSource;
Edit1: TEdit;
gridMembers: TDBGrid;
DBNavigator1: TDBNavigator;
SQLite3Connection1: TSQLite3Connection;
queryMembers: TSQLQuery;
SQLTransaction1: TSQLTransaction;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
SQLite3Connection1.Open;
{Comment out
querymembers.SQL.text:= 'SELECT * from Members where Lastname = :Lastname';
querymembers.Params.ParamByName ('Lastname').AsString := Edit1.text;
Comment out end }
SQLTransaction1.Active := True;
queryMembers.Open;
end;
End.
[/nobbc]
[...] I wouldn't know where to put the statement you just suggested.
Thanks for that. I dare say I'm not the first person to dive in without reading forum rules properly.And will probably not be the last, I guess :)
I hope you won't hold my inadvertent lack of manners against me.Nah, don't worry. All of us have been new sometime and it's quite common to dive into the forum and ask some question without getting to know first how the forum works; after all, you're more worried about your software. ;)
I know experts seem to prefer to write it in code whereas at the moment I'm finding it easier to automate as much as possible.Keep in my that if you distribute your program to another user, he might install it in a different place than you did and then it is very handy if you've set your path to the data in code (using common places as users folder or the ProgramData folder on your C drive). Not every user has the same name as you do, so his folder name for the data may differ. ;)
Taking the info from replies here (DevEric69) and by looking closely at the example that I was trying to reverse engineer, I set up a project from scratch, but using the existing database. Now I can select my DataField.
However, no matter what I do I still can't populate it with any data, despite the TDBGrid being populated just as I expected. NB this applies whether I set the database to open when the form opens or on a click of a button.