E
emailqjc
Unregistered / Unconfirmed
GUEST, unregistred user!
有如下DLL在delphi调用时候不稳定,有时出错,有时候不出错,请问什么原因[?]?
library yjCom;
uses
SysUtils,
Classes,
Dialogs,
Forms,
ADODB,
db,
Activex,
windows,
StdCtrls,
u_DBcnn in 'u_DBcnn.pas' {DBcnn: TDataModule};
{$R *.res}
var
SeqNumber:integer;//包序号
procedure DLLEntryPoint(dwReason: DWord);
begin
case dwReason of
DLL_PROCESS_ATTACH:begin //进程进入时
CoInitialize(nil);
end;
DLL_PROCESS_DETACH:begin //进程退出时
CoUninitialize;
end;
end;
end;
function QueryUserInfo(AUseridChar)char;stdcall
//用户查询
begin
DBcnn:=TDBcnn.Create(nil);
try
with DBcnn.ADQ do
begin
close;
sql.Clear;
sql.Text:='select yhxm,dzm,dh,areaname,dz,djrq,yhs from view_baseinfo where UID='''+Trim(AUserid)+'''';
open;
first;
if recordcount=0 then
begin
Result:='';
exit;
end;
end;
Result:=PCHAR(DBcnn.ADQ.FieldByName('yhxm').AsString+' '+DBcnn.ADQ.FieldByName('dzm').AsString+' '+
DBcnn.ADQ.FieldByName('dh').AsString+' '+DBcnn.ADQ.FieldByName('areaName').AsString+' '+
DBcnn.ADQ.FieldByName('dz').AsString+' '+DBcnn.ADQ.FieldByName('djrq').AsString+' '+
DBcnn.ADQ.FieldByName('yhs').AsString);
finally
end;
end;
exports
QueryUserInfo;
begin
DllProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.
library yjCom;
uses
SysUtils,
Classes,
Dialogs,
Forms,
ADODB,
db,
Activex,
windows,
StdCtrls,
u_DBcnn in 'u_DBcnn.pas' {DBcnn: TDataModule};
{$R *.res}
var
SeqNumber:integer;//包序号
procedure DLLEntryPoint(dwReason: DWord);
begin
case dwReason of
DLL_PROCESS_ATTACH:begin //进程进入时
CoInitialize(nil);
end;
DLL_PROCESS_DETACH:begin //进程退出时
CoUninitialize;
end;
end;
end;
function QueryUserInfo(AUseridChar)char;stdcall
//用户查询
begin
DBcnn:=TDBcnn.Create(nil);
try
with DBcnn.ADQ do
begin
close;
sql.Clear;
sql.Text:='select yhxm,dzm,dh,areaname,dz,djrq,yhs from view_baseinfo where UID='''+Trim(AUserid)+'''';
open;
first;
if recordcount=0 then
begin
Result:='';
exit;
end;
end;
Result:=PCHAR(DBcnn.ADQ.FieldByName('yhxm').AsString+' '+DBcnn.ADQ.FieldByName('dzm').AsString+' '+
DBcnn.ADQ.FieldByName('dh').AsString+' '+DBcnn.ADQ.FieldByName('areaName').AsString+' '+
DBcnn.ADQ.FieldByName('dz').AsString+' '+DBcnn.ADQ.FieldByName('djrq').AsString+' '+
DBcnn.ADQ.FieldByName('yhs').AsString);
finally
end;
end;
exports
QueryUserInfo;
begin
DllProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.