str:='insert into s(水总指数) Values (:s)'
.....
Close;
SQL.Clear;
SQL.Add(str)
Paramters.parambyname('s').value:=strToint(edit.text);
.......
.....
Close;
SQL.Clear;
SQL.Add(str)
Paramters.parambyname('s').value:=strToint(edit.text);
.......
var str : string;
i: integer;
begin
if Trim(Edit1.Text) <>'' then
begin
str:='insert into s(水总指数) Values to_char('+i+')';
with ado do
begin
i:=strtoint(edit1.Text);
close;
SQL.Clear;
SQL.Add(format(str,[i]));
prepared;
ExecSQL;
end;
end;
说Paramters是未经申报的标识符
‘access voilation at adress 1F487CAB in module 'MSADO15'.Write of
adress 01258018'
确定后就非法操作,紧接着死机~
var str : string;
i: integer;
begin
if Trim(Edit1.Text) <>'' then
begin
str:='insert into s(水总指数) Values (%d)';
with ado do
begin
i:=strtoint(edit1.Text);
close;
SQL.Clear;
SQL.Add(format(str,[i]));
prepared;
ExecSQL;
end;
end;
if Trim(Edit1.Text) <>'' then
begin
str:='insert into s(水总指数) Values (''%s'')';
with ado do
begin
close;
SQL.Clear;
SQL.Add(format(str,[edit1.text]));
prepared;
try
ExecSQL;
except
showmessage("error");
end;