I need to get result of select statement in Lazarus and assign this result to edit.text.
CODE:
procedure TForm1.Button1Click(Sender: TObject);
var
Q: TSQLQuery;
d: string;
begin
//Q := TSQLQuery.Create(nil);
with OracleConnection1 do
begin
Connected := true;
SQLTransaction1.Active:= True;
DataSource1.Enabled:=true;
DataSource1.DataSet := Q;
end;
if OracleConnection1.Connected then
Q.SQL.Text := 'SELECT description FROM part where part= "00000" ';
Q.Active:=true;
Q.ExecSQL;
d := datasource1.DataSet;
//DBText1.ExecuteAction();
dbedit1.Text:= q.DataSource.DataSet.Fields.;
Edit1.Text:= Q.SQL.Text;
showmessage('CONNECTED');
sql.Active:=true;
end;
You've got quite a few errors in your code. You should probably find a tutorial on Delphi somewhere (which is very similar to Lazarus and FreePascal).
procedure TForm1.Button1Click(Sender: TObject);
var
Qry: TSQLQuery;
begin
Qry := TSQLQuery.Create(nil);
with OracleConnection1 do
begin
Connected := true;
SQLTransaction1.Active:= True;
DataSource1.Enabled:=true;
DataSource1.DataSet := Q;
end;
if OracleConnection1.Connected then
begin
showmessage('CONNECTED');
Qry.SQL.Text := 'SELECT description FROM part where part= "00000" ';
Qry.Open;
Edit1.Text:= Qry.FieldByName('description').AsString;
end;