声明没有错误,可能你只声明没定义吧private
function check_datetime(as_date:string):tdatetime;////////
{ Private declarations }
public
ib_flag:boolean;
{ Public declarations }
function check_datetime(as_date:string):tdatetime;////////
beginend;
function check_datetime(as_date:string):tdatetime;////////
{ Private declarations }
public
ib_flag:boolean;
{ Public declarations }
function check_datetime(as_date:string):tdatetime;////////
beginend;
unit leave;interfaceuses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls, Mask, ADODB, Db;type
Tform_vacation = class(TForm)
BitBtn_ok: TBitBtn;
BitBtn_reset: TBitBtn;
BitBtn_exit: TBitBtn;
Label_id: TLabel;
Label_name: TLabel;
Label_item: TLabel;
Edit_id: TEdit;
Edit_name: TEdit;
Label_begin_date: TLabel;
Label_end_date: TLabel;
Label_reason: TLabel;
Memo_reason: TMemo;
Label1: TLabel;
Label2: TLabel;
MaskEdit_begin: TMaskEdit;
DateTimePicker_begin: TDateTimePicker;
DateTimePicker_end: TDateTimePicker;
MaskEdit_end: TMaskEdit;
ComboBox_item: TComboBox;
ADODataSet_temp: TADODataSet;
ADOQuery1: TADOQuery;
procedure BitBtn_exitClick(Sender: TObject);
procedure BitBtn_okClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn_resetClick(Sender: TObject);
private
function check_datetime(as_date:string):tdatetime;
{ Private declarations }
public
ib_flag:boolean;
{ Public declarations }
end;var
form_vacation: Tform_vacation;
ii_tempid:integer;
implementation
uses check_data;
{$R *.DFM}
function check_date(as_date:string):tdatetime;
begin
check_date:=strtodatetime('2002-4-3 12:12:00');
end;procedure Tform_vacation.BitBtn_exitClick(Sender: TObject);
begin
ib_flag:=false;
self.close;
end;procedure Tform_vacation.BitBtn_okClick(Sender: TObject);
var
ls_datetime_begin:string;
ls_datetime_end:string;
ls_type:string;
ldate_begin:tdatetime;
ldate_end:tdatetime;
ls_user_id:string;
ls_reason:string;
begin
// if maskedit_begin.text:='' then
showmessage(maskedit_begin.text);
exit;
ls_datetime_begin:=datetostr(datetimepicker_begin.date) + ' ' + maskedit_begin.Text+':00';
ls_datetime_end:=datetostr(datetimepicker_end.date) + ' ' + maskedit_end.Text+':00';
// if ls_datetime_begin then
try
begin
ldate_begin:=strtodatetime(ls_datetime_begin);
ldate_end:=strtodatetime(ls_datetime_end);
end;
except
begin
showmessage('δÊäÈëʱ¼äÖµ');
exit;
end;
end;
//showmessage(datetimetostr(datetimepicker_begin.datetime));
//showmessage(datetostr(date()));
ls_user_id:='1';
ls_type:=combobox_item.text;
ls_reason:=memo_reason.lines.text;
adoquery1.sql.clear;
adoquery1.SQL.Add('insert into vacation(employee_id,vacation_type,vacation_begin,vacation_end,vacation_causation,user_id)values(:li_id,'''+ls_type+''',:ldate_begin,:ldate_end,'''+ls_reason+''','''+ls_user_id+''')');
adoquery1.Parameters.ParamByName('ldate_begin').value:=ldate_begin;
adoquery1.Parameters.ParamByName('ldate_end').value:=ldate_end;
adoquery1.Parameters.ParamByName('li_id').value:=ii_tempid;
adoquery1.ExecSQL;
ib_flag:=true;
self.close;end;procedure Tform_vacation.FormShow(Sender: TObject);
var
ls_list:tstrings;begin
ib_flag:=false;
ls_list:=tstringlist.Create;
ls_list.add('');
memo_reason.lines:=ls_list;ii_tempid:=form_check.ii_id;if combobox_item.items.Count <= 0 then
begin
combobox_item.items.Add('ʼÙ');
combobox_item.items.Add('»é¼Ù');
combobox_item.items.Add('¹«ÐݼÙ');
combobox_item.items.Add('²¡¼Ù');
combobox_item.items.Add('É¥¼Ù');
combobox_item.items.Add('²ú¼Ù');
end;
combobox_item.ItemIndex:=0; try
adodataset_temp.close;
adodataset_temp.CommandText:='select employee.employee_id,employee.employee_name from employee where employee_id = :li_id';
adodataset_temp.Parameters.parambyname('li_id').value:=ii_tempid;
adodataset_temp.open;
edit_id.text:=adodataset_temp.fields[0].asstring;
edit_name.text:=adodataset_temp.fields[1].asstring;
finally
if adodataset_temp.eof then
adodataset_temp.last
else if adodataset_temp.bof then
adodataset_temp.first;
adodataset_temp.close;
end;end;procedure Tform_vacation.BitBtn_resetClick(Sender: TObject);
var
ls_list:tstrings;
begin
maskedit_begin.text:='';
maskedit_end.text:='';
ls_list:=tstringlist.Create;
ls_list.add('');
memo_reason.lines:=ls_list;
combobox_item.text:='';end;
end.
错误:
[Error] leave.pas(37): Unsatisfied forward or external declaration: 'Tform_vacation.check_datetime'
function check_datetime(as_date:string):tdatetime;
在代码中没有写这个函数体。
而代码中没有写这个函数体是
function check_date(as_date:string):tdatetime
确没有定义
把这个函数体改成:
function Tform_vacation.check_date(as_date:string):tdatetime
就行了
在你的函数实现代码的函数名前加上类的名字
function Tform_vacation.check_date(……
因为你定义的是类的成员函数,而你现在却在实现一个单元的私有函数,所以会出错!!我当初也常犯这样的错误,建议你使用右击快捷菜单中的自动完成功能!!