K
K
Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个UDFs为何不能用?请帮我看看错在哪里(我模彷例子可别笑我)。谢谢!
1、用Delphi制作dll,并编译。
library SdlDll;
uses
SysUtils;
{$R *.RES}
function IB_Sysdate:ShortString;stdcall;overload;
begin
Result:=FormatDateTime('yyyymm',date);
end;
exports
IB_Sysdate;
end.
2、将sdldll.dll文件考到:c:/Program Files/Interbase/UDF(不知这样做对不对)
3、运行InterBase6.01并进行定义
DECLARE EXTERNAL FUNCTION SYSDATE
CSTRING(80) CHARACTER SET NONE
RETURNS CSTRING(80) CHARACTER SET NONE FREE_IT
ENTRY_POINT 'IB_sysdate' MODULE_NAME 'sdldll.dll';
4、设定计数器(与相关的CREATE GENERATOR定义我己测试过没问题所以省略)
L_RECORDS表的NUMBERID字段类型varchar(20)
set term!!;
create TRIGGER SET_L_RECORDS for L_RECORDS
before insert as
begin
New.NUMBERID=sysdate||cast(gen_id(L_RECORDS_GEN,1) as varchar(10));
end!!
set term;!!
exit;
1、用Delphi制作dll,并编译。
library SdlDll;
uses
SysUtils;
{$R *.RES}
function IB_Sysdate:ShortString;stdcall;overload;
begin
Result:=FormatDateTime('yyyymm',date);
end;
exports
IB_Sysdate;
end.
2、将sdldll.dll文件考到:c:/Program Files/Interbase/UDF(不知这样做对不对)
3、运行InterBase6.01并进行定义
DECLARE EXTERNAL FUNCTION SYSDATE
CSTRING(80) CHARACTER SET NONE
RETURNS CSTRING(80) CHARACTER SET NONE FREE_IT
ENTRY_POINT 'IB_sysdate' MODULE_NAME 'sdldll.dll';
4、设定计数器(与相关的CREATE GENERATOR定义我己测试过没问题所以省略)
L_RECORDS表的NUMBERID字段类型varchar(20)
set term!!;
create TRIGGER SET_L_RECORDS for L_RECORDS
before insert as
begin
New.NUMBERID=sysdate||cast(gen_id(L_RECORDS_GEN,1) as varchar(10));
end!!
set term;!!
exit;