displaying data without dbgrid lazarus / 16-Databases ---------------------------------------------------------------------- speter · 2020-12-24 04:28 G'Day Folks, My exploration of databases (firebird) is moving along in leaps and bounds (or maybe lurches and stumbles). At present I can create tables, insert and retrieve data; so all is good. My question today is: how can I display information without using dbgrid? For example: the result of my search is one or more records each of which include a paragraph of text and an image filename. I'd like to display the text and image (for the current record) and allow the use to move to the next (or previous) record. The attached image may show it better. It is a screen-shot of a web- page I created some years ago (using ASP & Ajax). The images on the left allow the user to move through the records, while the information on the particular plant is displayed on the right. cheers S. ---------------------------------------------------------------------- Handoko · 2020-12-24 04:46 Default Lazarus installation has plenty of useful example source codes: Lazarus main menu > Tools > Example Projects > type the keyword on the search box For example you can use keyword "database", then you can see the example "image_mushroom". For your information, you should not open the demo directly from the original location. It usually better to make a copy for example to your desktop. ---------------------------------------------------------------------- speter · 2020-12-24 06:21 Thanks Handoko, I'll check it out. cheers S. ---------------------------------------------------------------------- speter · 2020-12-25 10:24 G'Day Folks, Well, after much interesting exploration I can answer my question! Submit the sql with something like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   SQLQuery1.close;  SQLQuery1.SQL.clear;  SQLQuery1.SQL.Text := 'select id, info from footable';  DBConnection.Connected:= True;  SQLTransaction1.Active:= True;  SQLQuery1.Open; Assuming something like the above worked, you can loop through the records with something like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   repeat  memo1.append(    'id = '+DataSource1.DataSet.Fields[0].AsString +               ', info = '+DataSource1.DataSet.Fields[1].AsString);    DataSource1.DataSet.next;  until DataSource1.DataSet.eof; You may also use: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i DataSource1 .DataSet.first;DataSource1.DataSet.last;DataSource1.DataSet.previous;t o "move around" the record set. Now, for the true masochists out there; I am posting my "plant nursery" database project! My recommendation is to look at the screenshot, and then move on with your life! If you don't have Firebird 3.0.7 you may not be able to read the database (but I don't know...) The database accesses 11 jpg images, which are NOT included in the project .zip file (but the database is there). The database lists the images as text; they are: Code: [Select]http://anpsa.org.au/jpg/b-aemula.jpg http://anpsa.org.au/jpg2/b-cunea.jpg http://anpsa.org.au/jpg3/B-nut.jpg http://anpsa.org.au/jpg2/840140.jpg http://anpsa.org.au/jpg3/A-bail.jpg http://anpsa.org.au/jpg3/a-deal.jpg http://anpsa.org.au/jpg1/t-asper.jpg http://anpsa.org.au/jpg3/imp9205.jpg http://anpsa.org.au/jpg/931825a.jpg http://anpsa.org.au/jpg/921221a.jpg http://anpsa.org.au/jpg3/imp0984.jpgSo, if you want to see the project in its full glory I suggest you grab the images and put them in a folder called "images". In my project the "images" folder is in the project's folder... If you get that far, make sure you read the notes I've included at the top of the main unit (mainu.pas); I can totally guarantee that the project will NOT run "as is". You will need to put your firebird password and change the database path (and probably other stuff as well). Masochists delight! Good Luck and Happy Christmas to everyone! cheers S.