这里library Project1;的中程序function Data(strtime:string):boolean;stdcall;
begin
result:=false;
with DataModule1.ADOQ do
begin
DataModule1.ADOQ.Close; 执行的时候这里出错了!
DataModule1.ADOQ.SQL.Clear;
DataModule1.ADOQ.SQL.Add('select * from name where name='+strtime);
DataModule1.ADOQ.Open;
if DataModule1.ADOQ.RecordCount>1 then
begin
result:=true;
end;
end;
end;exports
Data;begin
end.编译的时候没有错误,执行的就错了! 在DLL程序中到底是怎么调用ADOQuery和ADOTable等组件啊!那个朋友还能给点代码我看看!谢谢哦!
begin
result:=false;
with DataModule1.ADOQ do
begin
DataModule1.ADOQ.Close; 执行的时候这里出错了!
DataModule1.ADOQ.SQL.Clear;
DataModule1.ADOQ.SQL.Add('select * from name where name='+strtime);
DataModule1.ADOQ.Open;
if DataModule1.ADOQ.RecordCount>1 then
begin
result:=true;
end;
end;
end;exports
Data;begin
end.编译的时候没有错误,执行的就错了! 在DLL程序中到底是怎么调用ADOQuery和ADOTable等组件啊!那个朋友还能给点代码我看看!谢谢哦!
这里写错了吧
dll的参数用pchar传
如果可以的话,我可以把代码发给你,给我看看,留下你的邮箱地址就可以了!
你的ADOQ是打开的码
begin
result:=false;
with DataModule1.ADOQ do
begin
Close;
SQL.Clear;
SQL.Add('select top 1 * from Tabname where name='+''''+strtime+'''');
Open;
If RecordCount>1 then result:=true;
Close;
end;
end;
SQL.Add('select top 1 * from Tabname where name='+''''+strtime+'''');
应为:
SQL.Add('select top 2 * from Tabname where name='+''''+strtime+'''');或者将 If RecordCount>1 改为: If RecordCount>0
应该没有问题吧?
[email protected]
begin
result:=false;
CoInitialize(nil); //uses ActiveX;
try
DataModule1 := TDataModule.Create(Application);
with DataModule1.ADOQ do
begin
DataModule1.ADOQ.Close; 执行的时候这里出错了!
DataModule1.ADOQ.SQL.Clear;
DataModule1.ADOQ.SQL.Add('select * from name where name='+strtime);
DataModule1.ADOQ.Open;
if DataModule1.ADOQ.RecordCount>1 then
begin
result:=true;
end;
end;
finally
FreeAndNIl(DataModule1);
Couninitialize;
end;
end;