Answer the question
In order to leave comments, you need to log in
Why if you add a value to the database through a variable, then "ADOQuery1" is added, and if directly, then a normal value?
Hello.
There is such a code
procedure TForm1.FramePositionsAdd1ButtonAddClick(Sender: TObject);
var
Name: String;
begin
Name := FramePositionsAdd1.EditName.Text;
with FramePositionsAdd1.ADOQuery1 do
begin;
SQL.Clear;
SQL.Text := 'INSERT INTO Должности ' +
'(Наименование) ' +
'VALUES ' +
'(:title)';
Parameters.ParamByName('title').Value := Name;
ExecSQL;
end;
end;
FramePositionsAdd1.EditName.Text
the string "ADOQuery1" is added instead. Name
. One line changes:Parameters.ParamByName('title').Value := FramePositionsAdd1.EditName.Text;
Answer the question
In order to leave comments, you need to log in
WITH is evil.
You add the value FramePositionsAdd1.ADOQuery1.Name to the database
procedure TForm1.FramePositionsAdd1ButtonAddClick(Sender: TObject);
begin
FramePositionsAdd1.ADOQuery1.SQL.Text := 'INSERT INTO Должности (Наименование) ' +
'VALUES ''' + FramePositionsAdd1.EditName.Text + ''''
FramePositionsAdd1.ADOQuery1.ExecSQL;
end;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question