顺
顺顺
Unregistered / Unconfirmed
GUEST, unregistred user!
type
TSQLData = packed record
SQLBuf : array [0..511] of Char;
RecordCount: DWORD;
end;
pSQLData = ^ TSQLData;
function ThreadExecSQL(_sSQL:String):integer;
var
dwThreadIdWORD;
hThread :THANDLE;
sSQLData SQLData;
function LogExecSQL(sSQLStrSQLData):integer;
var
ADOQuerySQLExec :TADOQuery;
//sSQLStr :TSQLBuf;
begin
try
//MoveMemory(@sSQLStr,pSQL,SizeOf(TSQLBuf));
ShowMessage(sSQLStr.SQLBuf);
Result:=0;
ADOQuerySQLExec:=TADOQuery.Create(nil);
with ADOQuerySQLExecdo
begin
Close;
Connection:=DM.Conn;
SQL.Clear;
SQL.Add(sSQLStr);
ExecSQL;
Close;
Free;
end;
except
end;
end;
begin
try
New(sSQLData);
StrPCopy(sSQLData.SQLBuf,_sSQL);
hThread := CreateThread(
nil, 0, @LogExecSQL,@sSQLData, 0, dwThreadId
);
except
on E:Exceptiondo
ShowMessage(e.Message);
end;
end;
我的大意是要用线程执行无返回的sQL语句, 可我不知道用CreateThread的参数怎么传递.
就是传 送 SQL语句到 LogExecSQL中. 请各位大哥多多指点
TSQLData = packed record
SQLBuf : array [0..511] of Char;
RecordCount: DWORD;
end;
pSQLData = ^ TSQLData;
function ThreadExecSQL(_sSQL:String):integer;
var
dwThreadIdWORD;
hThread :THANDLE;
sSQLData SQLData;
function LogExecSQL(sSQLStrSQLData):integer;
var
ADOQuerySQLExec :TADOQuery;
//sSQLStr :TSQLBuf;
begin
try
//MoveMemory(@sSQLStr,pSQL,SizeOf(TSQLBuf));
ShowMessage(sSQLStr.SQLBuf);
Result:=0;
ADOQuerySQLExec:=TADOQuery.Create(nil);
with ADOQuerySQLExecdo
begin
Close;
Connection:=DM.Conn;
SQL.Clear;
SQL.Add(sSQLStr);
ExecSQL;
Close;
Free;
end;
except
end;
end;
begin
try
New(sSQLData);
StrPCopy(sSQLData.SQLBuf,_sSQL);
hThread := CreateThread(
nil, 0, @LogExecSQL,@sSQLData, 0, dwThreadId
);
except
on E:Exceptiondo
ShowMessage(e.Message);
end;
end;
我的大意是要用线程执行无返回的sQL语句, 可我不知道用CreateThread的参数怎么传递.
就是传 送 SQL语句到 LogExecSQL中. 请各位大哥多多指点