Y
ywan
Unregistered / Unconfirmed
GUEST, unregistred user!
各位新年好!小弟在使用自定义function和procedure时出现以下错误:
Unsatisfied forward or external declaration :"TdataModule5.check_oder"
Unsatisfied forward or external declaration :"TdataModule5.get_id"
Unsatisfied forward or external declaration :"TdataModule5.add_data"
具体程序如下
unit Unit5;
interface
uses
SysUtils, Classes, DB, ADODB;
type
TDataModule5 = class(TDataModule)
ADOConnection1: TADOConnection;
Oder_ADOQuery: TADOQuery;
Ins_ADOQuery: TADOQuery;
Out_ADOQuery: TADOQuery;
Save_ADOQuery: TADOQuery;
Oder_DataSource: TDataSource;
Ins_DataSource: TDataSource;
Out_DataSource: TDataSource;
Save_DataSource: TDataSource;
function check_oder (var get_query :Tadoquery
get_name:string):boolean;//这里出错
function get_id (var get_query1:Tadoquery
get_names:string ): integer;//这里出错
procedure add_data( var add_query add_name,add_table:string
add_quanlity :integer);;//这里出错
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule5: TDataModule5;
implementation
{$R *.dfm}
function check_oder (var get_query:tadoquery
get_name:string):boolean;
var
sql_text:string
begin
sql_text:='select * from oder ';
sql_text:=sql_text + 'where name = '
sql_text:=sql_text + get_name
with get_query do
begin
close;
sql.clear;
sql.add(sql_text);
open;
if not eof then
result:=true
else
result:=false;
end;
end;
function get_id(var get_query1:tadoquery
get_name:string):integer;
var
sql_text1 :string;
begin
sql_text1:='select * from oder';
sql_text1:=sql_text1 + ' where name = ';
sql_text1:=sql_text1 + ' get_name ';
with get_query1 do
begin
close;
sql.clear;
sql.add(sql_text1);
open;
result:=fieldbyname('ID').asinteger;
end;
end;
procedure add_data ( var add_query2 :Tadoquery add_table:string
add_id,add_quanlity :integer);
var
sql_text2:string;
begin
sql_text2:='insert into '+ add_table;
sql_text2:=sql_text2 + ' ID, quanlity, date ';
sql_text2:=sql_text2 + 'value id, :quanlity :date )';
with add_query2 do
begin
close;
sql.clear;
sql.add(sql_text2);
parameters.parambyname('id').value:=add_id;
parameters.parambyname('quanlity').value:=add_quanlity;
parameters.parambyname('date').value:=date;
open;
end;
end;
end.
Unsatisfied forward or external declaration :"TdataModule5.check_oder"
Unsatisfied forward or external declaration :"TdataModule5.get_id"
Unsatisfied forward or external declaration :"TdataModule5.add_data"
具体程序如下
unit Unit5;
interface
uses
SysUtils, Classes, DB, ADODB;
type
TDataModule5 = class(TDataModule)
ADOConnection1: TADOConnection;
Oder_ADOQuery: TADOQuery;
Ins_ADOQuery: TADOQuery;
Out_ADOQuery: TADOQuery;
Save_ADOQuery: TADOQuery;
Oder_DataSource: TDataSource;
Ins_DataSource: TDataSource;
Out_DataSource: TDataSource;
Save_DataSource: TDataSource;
function check_oder (var get_query :Tadoquery
get_name:string):boolean;//这里出错
function get_id (var get_query1:Tadoquery
get_names:string ): integer;//这里出错
procedure add_data( var add_query add_name,add_table:string
add_quanlity :integer);;//这里出错
private
{ Private declarations }
public
{ Public declarations }
end;
var
DataModule5: TDataModule5;
implementation
{$R *.dfm}
function check_oder (var get_query:tadoquery
get_name:string):boolean;
var
sql_text:string
begin
sql_text:='select * from oder ';
sql_text:=sql_text + 'where name = '
sql_text:=sql_text + get_name
with get_query do
begin
close;
sql.clear;
sql.add(sql_text);
open;
if not eof then
result:=true
else
result:=false;
end;
end;
function get_id(var get_query1:tadoquery
get_name:string):integer;
var
sql_text1 :string;
begin
sql_text1:='select * from oder';
sql_text1:=sql_text1 + ' where name = ';
sql_text1:=sql_text1 + ' get_name ';
with get_query1 do
begin
close;
sql.clear;
sql.add(sql_text1);
open;
result:=fieldbyname('ID').asinteger;
end;
end;
procedure add_data ( var add_query2 :Tadoquery add_table:string
add_id,add_quanlity :integer);
var
sql_text2:string;
begin
sql_text2:='insert into '+ add_table;
sql_text2:=sql_text2 + ' ID, quanlity, date ';
sql_text2:=sql_text2 + 'value id, :quanlity :date )';
with add_query2 do
begin
close;
sql.clear;
sql.add(sql_text2);
parameters.parambyname('id').value:=add_id;
parameters.parambyname('quanlity').value:=add_quanlity;
parameters.parambyname('date').value:=date;
open;
end;
end;
end.