Forum > Databases

[SOLVED} SQLite Zeos Update

(1/5) > >>

Pe3s:
Hi I have tables id, Name, Last_name
when I load the table it does not show the id column
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT Name, Last_name FROM tableI am downloading the data to the form

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button3Click(Sender: TObject);begin  LabeledEdit1.Text := ZQuery1.FieldByName('Name').AsString;  LabeledEdit2.Text := ZQuery1.FieldByName('Last_name').AsString;end;
Updates data


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button4Click(Sender: TObject);begin  ZQuery1.SQL.Clear;  ZQuery1.SQL.Text := 'UPDATE laski SET Name=:Name,Last_name=:Last_Name  WHERE id=:id';  ZQuery1.ParamByName('Name').AsString := LabeledEdit1.Text;  ZQuery1.ParamByName('Last_name').AsString := LabeledEdit2.Text;   ZQuery1.ExecSQL;   ZQuery1.Sql.Text := 'SELECT  Name, Last_name FROM table';  ZQuery1.Open;end;
What do I need to fix to get the code to work ?

af0815:
Look in the discussion here https://forum.lazarus.freepascal.org/index.php/topic,59065.0.html

In you select statement is no ID.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT ID, Name, Last_name FROM laski

Pe3s:
Reading. Thanks

Pe3s:
If I read without id column

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT Name, LastName FROM tablehow to read id ?

Zvoni:

--- Quote from: Pe3s on April 20, 2022, 08:49:00 pm ---If I read without id column

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT Name, LastName FROM tablehow to read id ?

--- End quote ---
Easy!
You don‘t!
If it‘s not SELECTed, it‘s not available. Period.

Navigation

[0] Message Index

[#] Next page

Go to full version