再放一个ADOCONNECTION和一个adoquery,设置adoconnection的connectionstring属性,连接sqlserver数据库,然后设置adoquery和adoconnection相连。 在button点击事件中写 var str:string; begin str:=momo1.lines.text; with adoquery do begin close; sql.clear; sql.add('insert into table(***) values(:a)'); paramters.parambyname('a').value:=str; execsql; end; end;
在button点击事件中写
var
str:string;
begin
str:=momo1.lines.text;
with adoquery do
begin
close;
sql.clear;
sql.add('insert into table(***) values(:a)');
paramters.parambyname('a').value:=str;
execsql;
end;
end;
adoquery1.fieldbyname('**').asstring:=Memo1.text;
adoquery1.post;
估计你会先问adoquery何时用open何时用ExecSQL,呵呵,还是先去看书吧
2,写SQL,用AdoQuery。