L
liu2909432
Unregistered / Unconfirmed
GUEST, unregistred user!
---dll单元
library Project_dll;
uses
SysUtils,
Classes,
Unit_dll in 'Unit_dll.pas' {Form1};
{$R *.res}
exports
ini_contain;
begin
end.
---Project_dll单元中的一个单元
unit Unit_dll;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
{初始化一些必选项,例如:文化程度、民族等。设定默认初值}
procedure ini_contain(H: THandle
{ 获得调用者的句柄 }
PStoredProc:TStoredProc
//后台存储过程
Pfieldname:widestring
//使用的字段名
Pcombobox:Tcombobox
//列出字段组件
PItemIndex:integer
//默认初值
Psign:widestring //标时每个小表的代号
);cdecl;
implementation
{$R *.dfm}
{初始化一些必选项,例如:文化程度、民族等。设定默认初值}
procedure ini_contain(H: THandle
{ 获得调用者的句柄 }
PStoredProc:TStoredProc
//后台存储过程
Pfieldname:widestring
//使用的字段名
Pcombobox:Tcombobox
//列出字段组件
PItemIndex:integer
//默认初值
Psign:widestring //标时每个小表的代号
);
begin
Application.Handle:=H;
with Tform1.Create(application) do
With PStoredProc do
begin
close;
parambyname('@sign').Value :=Psign;
open;
first;
Pcombobox.Clear;
while not eof do
begin
Pcombobox.Items.add(fieldbyname(Pfieldname).AsString);
next;
end;
end;
Pcombobox.ItemIndex:=PItemIndex;
end;
end.
-----主调单元
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Button1: TButton;
StoredProc1: TStoredProc;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{初始化一些必选项,例如:文化程度、民族等。设定默认初值}
procedure ini_contain(H: THandle
{传递句柄}
PStoredProc:TStoredProc
//后台存储过程
Pfieldname:widestring
//使用的字段名
Pcombobox:Tcombobox
//列出字段组件
PItemIndex:integer
//默认初值
Psign:widestring //标时每个小表的代号
);cdecl
External'project_dll.dll';
procedure TForm1.Button1Click(Sender: TObject);
begin
ini_contain(Application.Handle,StoredProc1,'name',combobox1,0,'1');
end;
end.
---后台过程
“create proc select_nation
@sign char(1)
as
select name from nation
”
---在combobox中可以返回查询的值, 在参数传递方面没有问题。
但是,在执行过程中,报一个错误“Exception EInvalidPointer in module PROJECT_DLL.DLL at 000027c4”
请高手指教。
一个关于dll的问题,急!急!
library Project_dll;
uses
SysUtils,
Classes,
Unit_dll in 'Unit_dll.pas' {Form1};
{$R *.res}
exports
ini_contain;
begin
end.
---Project_dll单元中的一个单元
unit Unit_dll;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
{初始化一些必选项,例如:文化程度、民族等。设定默认初值}
procedure ini_contain(H: THandle
{ 获得调用者的句柄 }
PStoredProc:TStoredProc
//后台存储过程
Pfieldname:widestring
//使用的字段名
Pcombobox:Tcombobox
//列出字段组件
PItemIndex:integer
//默认初值
Psign:widestring //标时每个小表的代号
);cdecl;
implementation
{$R *.dfm}
{初始化一些必选项,例如:文化程度、民族等。设定默认初值}
procedure ini_contain(H: THandle
{ 获得调用者的句柄 }
PStoredProc:TStoredProc
//后台存储过程
Pfieldname:widestring
//使用的字段名
Pcombobox:Tcombobox
//列出字段组件
PItemIndex:integer
//默认初值
Psign:widestring //标时每个小表的代号
);
begin
Application.Handle:=H;
with Tform1.Create(application) do
With PStoredProc do
begin
close;
parambyname('@sign').Value :=Psign;
open;
first;
Pcombobox.Clear;
while not eof do
begin
Pcombobox.Items.add(fieldbyname(Pfieldname).AsString);
next;
end;
end;
Pcombobox.ItemIndex:=PItemIndex;
end;
end.
-----主调单元
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, DBTables;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Button1: TButton;
StoredProc1: TStoredProc;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{初始化一些必选项,例如:文化程度、民族等。设定默认初值}
procedure ini_contain(H: THandle
{传递句柄}
PStoredProc:TStoredProc
//后台存储过程
Pfieldname:widestring
//使用的字段名
Pcombobox:Tcombobox
//列出字段组件
PItemIndex:integer
//默认初值
Psign:widestring //标时每个小表的代号
);cdecl
External'project_dll.dll';
procedure TForm1.Button1Click(Sender: TObject);
begin
ini_contain(Application.Handle,StoredProc1,'name',combobox1,0,'1');
end;
end.
---后台过程
“create proc select_nation
@sign char(1)
as
select name from nation
”
---在combobox中可以返回查询的值, 在参数传递方面没有问题。
但是,在执行过程中,报一个错误“Exception EInvalidPointer in module PROJECT_DLL.DLL at 000027c4”
请高手指教。
一个关于dll的问题,急!急!