L
LoveBorland
Unregistered / Unconfirmed
GUEST, unregistred user!
我在一个DLL(BaseDll.dll)中申明以下函数Delphi6+Win2000)
function IsCommander(s:String;b:Boolean):Boolean;
var
sSQL:String;
begin
DataModule1:=TDataModule1.Create(nil);
with DataModule1.query1 do
begin
close;
SQL.Clear;
if b=True then
sSQL:='Select * from jcFXYqk where (fxy_dm='+QuotedStr(s)+') and (x21s2<>'''')'
else
sSQL:='Select * from jcFXYqk where (fxy_dm='+QuotedStr(s)+') and (x21s1<>'''')';
SQL.Add(sSQl);
Open;
result:=RecordCount>0
end;
DataModule1.Free;
end;
exports IsCommander;
在主程序中调用:
procedure TForm1.Button1Click(Sender: TObject);
begin
if IsCommander(Edit6.Text,False) then
ShowMessage('Yes');
end;
程序能返回正确结果,但在调试时出现了一个错误:---------------------------
Project I:/Project1.exe faulted with message: 'access violation at 0x00000000: read of address 0x00000000'. Process Stopped. Use Step or Run to continue.
如果退出IDE环境单独运行,则主程序弹出Yes对话框架后后自动退出.
为什么?
我该如何正确调用.
function IsCommander(s:String;b:Boolean):Boolean;
var
sSQL:String;
begin
DataModule1:=TDataModule1.Create(nil);
with DataModule1.query1 do
begin
close;
SQL.Clear;
if b=True then
sSQL:='Select * from jcFXYqk where (fxy_dm='+QuotedStr(s)+') and (x21s2<>'''')'
else
sSQL:='Select * from jcFXYqk where (fxy_dm='+QuotedStr(s)+') and (x21s1<>'''')';
SQL.Add(sSQl);
Open;
result:=RecordCount>0
end;
DataModule1.Free;
end;
exports IsCommander;
在主程序中调用:
procedure TForm1.Button1Click(Sender: TObject);
begin
if IsCommander(Edit6.Text,False) then
ShowMessage('Yes');
end;
程序能返回正确结果,但在调试时出现了一个错误:---------------------------
Project I:/Project1.exe faulted with message: 'access violation at 0x00000000: read of address 0x00000000'. Process Stopped. Use Step or Run to continue.
如果退出IDE环境单独运行,则主程序弹出Yes对话框架后后自动退出.
为什么?
我该如何正确调用.