L
leozy
Unregistered / Unconfirmed
GUEST, unregistred user!
我作了一個Active Form ,加了一個TDataModule,並且能夠創建TDataModule
對象,但使用TDataModule,就會報錯:
"Access violation at address 06F5E9DB in module 'ZP.ocx' Read of address 0000005C"
到底Active Form 能否使用TDataModule,由該如何解決我的問題啊!!!!
下面是代碼.
/////TDataModule部分
unit DM;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms,
Dialogs, DBTables, DB, DBClient, MConnect, SConnect;
type
TCDM = class(TDataModule)
DSMain: TDataSource;
CDstMain: TClientDataSet;
SkctConn: TSocketConnection;
DShead: TDataSource;
CDShead: TClientDataSet;
DSbody: TDataSource;
CDSbody: TClientDataSet;
DSother: TDataSource;
CDSother: TClientDataSet;
DSTbody: TDataSource;
CDSTbody: TClientDataSet;
DSNMF: TDataSource;
CDSNMF: TClientDataSet;
DSML: TDataSource;
CDSmL: TClientDataSet;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
CDM_purheadid:double;
{ Public declarations }
end;
var
CDM: TCDM;
procedure CreatCDM;
implementation
{$R *.dfm}
/////////////////////////////////////////////////////////////
/////用這個函數來創建,是否正確????
procedure CreatCDM;
begin
TCDM.Create(nil)
end;
/////////////////////////////////////////////////////////////
procedure TCDM.DataModuleCreate(Sender: TObject);
begin
Showmessage('CDM') //////////這個消息框出現過///////
end;
end.
///////////////在ActiveX Form 中調用的代碼。
//創建
procedure Tz.ActiveFormCreate(Sender: TObject);
begin
DM.TCDM.Create(nil);
end;
//使用
procedure Tz.BtnRenewClick(Sender: TObject);
var
sqltext:string;
begin
sqltext:=ue_makesql();
DM.CDM.CDstMain.Active:=false
/////<----到這裡就出錯!
DM.CDM.CDstMain.CommandText:=sqltext;
DM.CDM.CDstMain.Active:=true;
end;
/////////////////////
到底是爲什麽,要如何解決阿??
對象,但使用TDataModule,就會報錯:
"Access violation at address 06F5E9DB in module 'ZP.ocx' Read of address 0000005C"
到底Active Form 能否使用TDataModule,由該如何解決我的問題啊!!!!
下面是代碼.
/////TDataModule部分
unit DM;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls, Forms,
Dialogs, DBTables, DB, DBClient, MConnect, SConnect;
type
TCDM = class(TDataModule)
DSMain: TDataSource;
CDstMain: TClientDataSet;
SkctConn: TSocketConnection;
DShead: TDataSource;
CDShead: TClientDataSet;
DSbody: TDataSource;
CDSbody: TClientDataSet;
DSother: TDataSource;
CDSother: TClientDataSet;
DSTbody: TDataSource;
CDSTbody: TClientDataSet;
DSNMF: TDataSource;
CDSNMF: TClientDataSet;
DSML: TDataSource;
CDSmL: TClientDataSet;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
CDM_purheadid:double;
{ Public declarations }
end;
var
CDM: TCDM;
procedure CreatCDM;
implementation
{$R *.dfm}
/////////////////////////////////////////////////////////////
/////用這個函數來創建,是否正確????
procedure CreatCDM;
begin
TCDM.Create(nil)
end;
/////////////////////////////////////////////////////////////
procedure TCDM.DataModuleCreate(Sender: TObject);
begin
Showmessage('CDM') //////////這個消息框出現過///////
end;
end.
///////////////在ActiveX Form 中調用的代碼。
//創建
procedure Tz.ActiveFormCreate(Sender: TObject);
begin
DM.TCDM.Create(nil);
end;
//使用
procedure Tz.BtnRenewClick(Sender: TObject);
var
sqltext:string;
begin
sqltext:=ue_makesql();
DM.CDM.CDstMain.Active:=false
/////<----到這裡就出錯!
DM.CDM.CDstMain.CommandText:=sqltext;
DM.CDM.CDstMain.Active:=true;
end;
/////////////////////
到底是爲什麽,要如何解決阿??