procedure ExecuteSQL(ssql:string);
var
DbConnection: IDBConnection;
dbSmt: IDBStatement;
nRet: Integer;
begin
if ConnManager.DBConnections.ContainsKey(ConnName) then
begin
ConnManager.GetDbConnetion(ConnName, DbConnection);
if Assigned(DbConnection) then
begin
dbSmt := DbConnection.CreateStatement;
dbSmt.SetSQLCommand(ssql);
try
nRet := dbSmt.Execute;
dbSmt:= nil;
except
ShowException(ExceptObject, ExceptAddr);
end;
end;
end;
end;
========================
Quotedstr(SId) 在变量前面加双引号,对sql中字符变量很有用,如:
SQL := 'update T1 set B= NULL where C = %s';
SQL := Format(SQL, [Quotedstr(SId)]);