Transmitter319
Technical User
Hi,
Im trying to get the syntax right on this. It works fine if I use this line
ADOQuery1.SQL.Text:= 'Insert INTO Button1 ( ArtistID, ArtistName, StringField2) VALUES (9,''simply red'',''This is a Test'')' ;
However if I try to stick the line below in the following and try sticking the name simply red into a text string it gives me an error. The name simply cannot be used in this context etc...
procedure TForm1.Button2Click(Sender: TObject);
var
test2 : string;
begin
test2 := 'simply red';
adoquery1.close();
adoquery1.SQL.Clear;
ADOQuery1.SQL.Text:= 'Insert INTO Button1 ( ArtistID, ArtistName, StringField2) VALUES (9,test2,''This is a Test'')' ;
adoquery1.ExecSQL;
end;
It seems to look like im using " on the posting but im using ' 'just incase it looks odd on this website.
Can someone give me an idea of how this should be done?
Thanks
Glen
Im trying to get the syntax right on this. It works fine if I use this line
ADOQuery1.SQL.Text:= 'Insert INTO Button1 ( ArtistID, ArtistName, StringField2) VALUES (9,''simply red'',''This is a Test'')' ;
However if I try to stick the line below in the following and try sticking the name simply red into a text string it gives me an error. The name simply cannot be used in this context etc...
procedure TForm1.Button2Click(Sender: TObject);
var
test2 : string;
begin
test2 := 'simply red';
adoquery1.close();
adoquery1.SQL.Clear;
ADOQuery1.SQL.Text:= 'Insert INTO Button1 ( ArtistID, ArtistName, StringField2) VALUES (9,test2,''This is a Test'')' ;
adoquery1.ExecSQL;
end;
It seems to look like im using " on the posting but im using ' 'just incase it looks odd on this website.
Can someone give me an idea of how this should be done?
Thanks
Glen