如下所示:
AdoQuery1.Connection :=FormPassword.ADOConnection1;
with AdoQuery1do begin
//Close;
SQL.Clear;
tempstr:='Update Users set PWD='''+trim(Edit2.Text)+''' where UserID='''+UserID+'''';
SQL.Text:=tempstr;
open;
end;
运行时发生错误:Missing Connection or Connectionstring.
不知为何,请赐教!
AdoQuery1.Connection :=FormPassword.ADOConnection1;
with AdoQuery1do begin
//Close;
SQL.Clear;
tempstr:='Update Users set PWD='''+trim(Edit2.Text)+''' where UserID='''+UserID+'''';
SQL.Text:=tempstr;
open;
end;
运行时发生错误:Missing Connection or Connectionstring.
不知为何,请赐教!
检查检查看看?
AdoQuery1.Connection :=FormPassword.ADOConnection1;
with AdoQuery1 do begin
Close;
SQL.Clear;
tempstr:='Update Users set PWD='''+trim(Edit2.Text)+''' where UserID='''+UserID+'''';
SQL.Text:=tempstr;
--> sqlexec;
end;bad english, try it!
ADOQrury1,sql.clear;
ADOquery1.sql.add('update tablename set pwd=:p1 where userID=:p2');
ADOquery1.parameter.parambyname('p1').values:=form1.edit1.text;
ADOquery1.parameter.parambyname('p2').values:=form1.edit2.text;
try
adoqurey1.execsql;
except end;
只有Select才能用Open;
AdoQuery1.Connection :=FormPassword.ADOConnection1;
with AdoQuery1 do begin
Close;
SQL.Clear;
SQL.Add('Update Users set PWD=:P1 where UserID=:P2');
Parameters.ParamByName('P1').Value :=NewPassword;
Parameters.ParamByName('P2').Value :=UserID;
ExecSQL;
end;
sql_string := 'update tbl_oper set oper_passwd='''+suiedit2.Text+
''' where oper_acct='''+ mainform.useracct+'''';
with datamd.tbl_oper do //datamd.tbl_oper为另一个单元的adouqery控件
begin
active := false;
sql.Clear;
sql.Add(sql_string);
execsql();
end;