保存数据问题!

xavitoor 2008-05-09 04:38:55
以下程序为虹膜注册并保存采集到的虹膜数据,运行过程中出现弹出CPU窗口,提示
“access violation at 0x00402a21。。。。”信息,如果强行运行,就耗死。
数据库对应的字段为text类型,SQL server2000数据库。
什么问题,请大家帮忙看一下,先谢过。

.......
type
EnrollCallBack = procedure(enroll_info: Integer;const moban_buf: PByte; moban_size: Integer;const bitmap_buf: PByte; bitmap_size, bitmap_num: Integer);stdcall;
.......
function IRIS_enroll(pCB: EnrollCallBack): Integer; cdecl; external 'iris.dll';
//虹膜注册回调函数
procedure EnrollCB(enroll_info: Integer; const moban: PByte; moban_size: Integer;
const bitmap_buf: PByte; bitmap_size, bitmap_num: Integer);cdecl;
......
//虹膜注册回调函数说明
procedure EnrollCB(enroll_info: Integer; const moban:PByte; moban_size: Integer;
const bitmap_buf: PByte; bitmap_size, bitmap_num: Integer);cdecl;
begin
PathStr:=ExtractFilePath(ParamStr(0));
if enroll_info = ENROLL_INFO_OK then
begin
iris_str := string(moban);
isis_buf:= moban;
isis_size:= moban_size;
SaveIRIS(BasicNostr,iris_str);
Playsound(PChar(PathStr+'\sound\enroll_success.wav'),0,SND_ASYNC);
end
else if (enroll_info = ENROLL_INFO_CAOSHI)then
Playsound(PChar(ExtractFilePath(ParamStr(0))+'\sound\enroll_timeout.wav'),0,SND_ASYNC)

end;
//保存虹膜函数说明
procedure SaveIRIS(BasicNoStr:string;IrisData:string);
var ADOqueryTmp:TadoqUERY;
begin
ADOqueryTmp:=TADOQuery.Create(nil);
ADOqueryTmp.Connection:=DataM.ADOConn;
with ADOqueryTmp do
begin
close;
sql.Clear;
sql.Add('update Pro_BasicInf set Iris='''+IrisData+''' where

BasicNo='''+BasicNoStr+'''');
try
execsql;
showmessage('虹膜数据已保存!');
except
ADOqueryTmp.free;
exit;
end;
end;
end;
。。。。
//调用
procedure TGetIrisForm.BitBtn1Click(Sender: TObject);
var
RES :integer;]
error:BIILEAN;
begin
error := false;
BasicNostr:='';
BasicNostr:=Label3.Caption;
RES := IRIS_enroll(@EnrollCB);
if RES <> IRIS_OK then
begin
error := true;
end;
end;
...全文
229 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zdlou 2008-05-29
  • 打赏
  • 举报
回复
断点跟下,如果存在数据库控件,应该保证其已与数据集连接,否则调用Dll方法时会报错
另,可能是编译器问题
天行归来 2008-05-09
  • 打赏
  • 举报
回复
cdecl修改成stdcall试试看。
The cdecl convention is useful when you call functions from shared libraries written in C or C++, while stdcall and safecall are recommended, in general, for calls to external code. On Windows, the operating system APIs are stdcall and safecall. Other operating systems generally use cdecl. (Note that stdcall is more efficient than cdecl.)
xavitoor 2008-05-09
  • 打赏
  • 举报
回复
只有仅有的60大洋,对不住各位了。。。

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧