Modules vs Class Modules in COM

Results 1 to 2 of 2

Thread: Modules vs Class Modules in COM

  1. #1
    Join Date
    Dec 1969

    Default Modules vs Class Modules in COM

    Is it ok to use Modules in VB COM project ? I see most information talks about class modules and nothing about Modules. I want to create a module that handles all my ADO and use class modules to access the Module&#039;s ADO functions etc. Is it ok to do this ?<BR><BR>Cheers<BR><BR>Paul

  2. #2
    SPG Guest

    Default RE: Modules vs Class Modules in COM

    AFAIK:<BR><BR>Modules are best served by containing functions & methods that do not rely upon *any* kind of state values. (Stuff like "formatDateLikeDDMonYY" and "isBlank"...)<BR><BR>Typically, I read this as "don&#039;t use ADO here", since ADO relies upon a state (connected/disconnected) and without an explicitly controllable COM wrapper on the Module (like you get on the class), I&#039;m just not comortable trusting that the memory ADO is using will be properly released if something goes wrong.<BR><BR>It is, however, 100% valid to write a class to handle all transactions with the database and then just do a <BR><BR>on error goto OOPS<BR>oDB = new dbHandler<BR>oDB.ConnString = "SQL-Server-612"<BR>foo = oDB.doThisThatAndOtherThing("foo")<BR>set oDB = nothing<BR><BR>as you can then do an <BR><BR>OOPS:<BR>if not oDB = nothing then set oDB = nothing<BR><BR>and have init and terminate subroutines in dbHandler to connect to a database on load & drop of the class.<BR><BR>HiH<BR>JM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts