利用TinyDB开发MIS系统问题(代码)在线等待(45分)

  • 主题发起人 主题发起人 网络3K
  • 开始时间 开始时间

网络3K

Unregistered / Unconfirmed
GUEST, unregistred user!
说明:DELPHI调用接口成功,VB6调用出错!
以下代码是开发DLL接口给VB调用的,但VB调用不成功,请各位高手帮忙看看看:)
//GetRS(AptPath, aMcaid:AnsiString):Boolean;Stdcall;
//AptPath→TinyDb数据库路径
//aMcaid→传递网卡地址
unit GetData;

interface


uses
Windows, TinyDB;

function GetRS(AptPath, aMcaid:AnsiString):Boolean;Stdcall;

implementation


function GetRS(AptPath, aMcaid:AnsiString):Boolean;Stdcall;
var
TTB:TTinyTable;
begin
try
TTB:=TTinyTable.Create(nil);
try
TTB.DatabaseName := AptPath;
TTB.TableName := 'Userinfo';
TTB.Password := 'hi0898_server_V0.1';
TTB.Open;

if TTB.FieldValues['Macid']=aMcaid then// 判断数据库中是否存在传递参数的网卡地址, 存在就返回值。
Result :=True
else Result := False;
finally
TTB.Close;
TTB.Free;
end;
except
Result := False;
end;
end;
 
GetRS(AptPath, aMcaid:AnsiString):Boolean;Stdcall;
你的输入参数的类型是ansiString,VB不知道这个是什么类型,当然会出错了。
建议你使用char* 类型。或者varant类型。
 
AnsiString 和WIN 32的String兼容!(我用PCHAR也不行)
VB可以读入数据库路径,但没有返回网卡ID。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部