I want to open a database/spreadsheet in a TDBGrid in Lazarus, and I've tried DBGrid1.LoadFromFile(filename);
with xml, csv, xlsx, odb. But with every file I get an error.
This is the code I'm using, with 'xml' being different each time I try:
procedure TForm1.FormCreate(Sender: TObject);
begin
DBGrid1.LoadFromFile('/home/pi/Jesse Gielen/PWS/Databeesjes/WoahWeerGegevens.xml');
end;
When I try xml, I get this error:
EDOMHierarchyRequest in Document.InsertBefore
When I try csv, this error appears:
Project project1 raised exception class 'EXMLReadError' (line 1 pos 1): Illegal at document level
When xlsx: Project project1 raised exception class 'EXMLReadError' (line 1 pos 3): Invalid character
When odb same as xlsx: Project project1 raised exception class 'EXMLReadError' (line 1 pos 3): Invalid character
So: How can I open a file in a DBGrid in Lazarus? If this isn't possible in any way (which I would find stange because why is there a procedure for it then?) then is my question: How can I translate a TStringgrid to a TDBGrid? (because loading a file into TStringgrid worked fine)