SQLQuery field not found on ubuntu lazarus / 1-Linux ---------------------------------------------------------------------- Gebo · 2024-09-30 06:43 I want an id value of an item from sqlquery by this code 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.Fields[0].AsInteger; but it show me a message that tell me " SQLQuery field not found ". that is on ubuntu but It is working on windows. ---------------------------------------------------------------------- dseligo · 2024-09-30 07:33 Did you check if you have records in your query? Try this: 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 If not SQLQuery1.EOF thenbegin  // do something with SQLQuery1.Fields[0].AsIntegerendelse  ShowMessage('No records.'); ---------------------------------------------------------------------- Zvoni · 2024-09-30 07:49 This is not making any sense. the "content" of a Database (Table, Column) doesn't care if it's "stored" on windows, linux, FreeBSD or my sock-drawer. Without seeing any Code (specifically the SQL-Statement) it's like gazing into a crystal ball ---------------------------------------------------------------------- Gebo · 2024-09-30 07:50 I already have 3 records but I want to delete a record that user selected on dbgrid by id . I want to get the id field of the record selected to delete it by sql query statement. ---------------------------------------------------------------------- rvk · 2024-09-30 08:51 Try to put some debug logging in your program. For example... put the following above that line that produces the error: 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   Showmessage('FieldCount = ' + SQLQuery1.Fields.Count.ToString);  Showmessage('Fields[0].FieldName = ' + SQLQuery1.Fields[0].FieldName); If the first gives you FieldCount > 0 then the second should work. If the first gives you 0 then you don't have any fields defined. The field definition should be done automatically during opening (if they are not predefined by you). I normally use SQLQuery1.FieldByName('id').AsInteger to get to a particular field. (Much easier than assuming the first field is the one you want) If it still doesn't work then you need to show more code. ---------------------------------------------------------------------- Gebo · 2024-09-30 10:48 when I use showmessage It shows me the field name "id" but when 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 SQLQuery1.FieldByName('id').AsInteger I get the message sqlquery field not found. ---------------------------------------------------------------------- nummer8 · 2024-09-30 10:51 What is the SqlQuery1.SQL.Text ? ---------------------------------------------------------------------- dseligo · 2024-09-30 11:09 Quote from: Gebo on September 30, 2024, 12:48:11 pmwhen I use showmessage It shows me the field name "id" but when use I am not sure I understand this. Are you saying that 'SQLQuery1.Fields[0].AsInteger;' works and that 'SQLQuery1.FieldByName('id').AsInteger' doesn't work? QuoteCode: 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.FieldByName('id').AsInteger I get the message sqlquery field not found. Did you test SQLQuery1.Eof as in reply #1? ---------------------------------------------------------------------- Thaddy · 2024-09-30 11:11 Can it just be a matter of CASE, like ID? ---------------------------------------------------------------------- Zvoni · 2024-09-30 11:16 Why don't we just play a bit of Lottery, or throw some dice around? UNTIL TS SHOWS HIS DAMNED SQL-Statement! ---------------------------------------------------------------------- Thaddy · 2024-09-30 11:18 Good point. ---------------------------------------------------------------------- dseligo · 2024-09-30 11:30 Quote from: Zvoni on September 30, 2024, 01:16:46 pmWhy don't we just play a bit of Lottery, or throw some dice around? UNTIL TS SHOWS HIS DAMNED SQL-Statement! And what RDBMS he use. ---------------------------------------------------------------------- rvk · 2024-09-30 12:55 Quote from: Gebo on September 30, 2024, 12:48:11 pmwhen I use showmessage It shows me the field name "id" but when 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 SQLQuery1.FieldByName('id').AsInteger I get the message sqlquery field not found. And also show EXACT error message and the relevant pascal code. It could just be a typo in your code. ---------------------------------------------------------------------- Gebo · 2024-10-13 07:08 Thanks all. the problem is I was close sqlquery and change sql statement then I write the line code. I fixed it by using a variable.