Subject Re: can I use a CDM the same way as I use a DMD?
From Ken Mayer <dbase@nospam.goldenstag.net>
Date Fri, 25 Sep 2020 06:09:55 -0700
Newsgroups dbase.getting-started

On 9/24/2020 9:13 PM, Gaetano wrote:
>
> Hi All,
>
> I have a CDM that only instantiates a database and a couple of functions
> for the rest of the app modules to inherit and use..
>
> Can I use is as a regular DMD, e.g.
>
> SET PROC to baseSO2dev.CDM addi
> oDMD = new BaseSO2devCDATAMODULE()
>
> cSQL="truncate table energydata_temp"
> oDMD.SO2ADO1.executeSQL(cSQL)

You are meant to use a CDM as the basis for other DMD files, just like
you cannot run a custom report or a custom form ...

> This is to keep the database connectivity details into once central and
> compiled file for easier maintenance and security bonus.
>
> It seems to be working but the Help entry for custom classes says:
>
> You can’t run a file you’ve developed in this way; it is simply a
> template from which other forms, reports, or data modules can be derived.

Exactly.

> I suspect this means that you can't double-click on them and see the
> resulting rowset if a rowset is part of the CDM, but I'd like to make
> sure before I hit a wall down the track...

It's not the best design, and it sets you up for some bad programming
habits. Create a dmd that uses the cdm file and you can then drag that
to a form or report in the designer and it will work fine.

Ken

--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm