Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data module

Status
Not open for further replies.

kumori25

Programmer
May 22, 2003
11
SG
hi,
i'm developing an application which uses the same few ado queries and datasets and connection. I'm trying to put them all together into the data module so that i will only have to create 1 of each for use by several forms.

however, when i try to make a call to these in the data module when running the application, i always hit an access violation error (something like access denied at memory location FFFFFF etc).

can anyone advice me on how to solve this. otherwise i will have to create the same ado queries and datasets for all the forms, which would be a waste of time.
 
hi,

If you cann't use the datamodule at all then their is something wrong in the creation of the datamodule. Perhaps the order of creation is wrong first create the datamodule and then the forms.
If you create the datamodule at the moment you create the form, so you can get mutiple instances of one datamodule, you put the code for the creation of the datamodule in the create of the form.
Hope this helps.

Steph [bigglasses]
 
hi, i don't really understand what you mean.

supposing i have an application with 6 forms and 1 datamodule which holds my one connection to the database and 6 adoqueries retrieving data from different database tables. do i have to create an instance of the datamodule in the 'OnCreate' event for each of the 6 forms (i.e. i would then have 6 instances of the datamodule) in order to access the adoqueries in the datamodule?

how then do i access the adoqueries in that datamodule instance?
 
When you start your application, delphi does a lot of things in the background.
Imagine you have 6 forms somehow linked together. On start-up these forms are created and made invisible to the user.

You can see this : Project --> view source

If one of the forms or datamodules is created out of sequence, this will result in access violation

Steven van Els
SAvanEls@cq-link.sr
 
The access violation might also be caused (depending on the database in use and ADO itself) if you're trying to access the DataSet from one screen when another screen has it locked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top