🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1989

Re: Accessing highest auto number

#1989
From: Ted Byers
Date: Fri, 05 Dec 2003 01:00
88 lines
6113 bytes
"Simon Elliott" <simon@nospam.demon.co.uk> wrote in message
news:u+Ye6EAXs6z$Iwiq@courtlands.demon.co.uk...
> Ted Byers <r.ted.byers@sympatico.ca> writes
> >My only worry is whether or not a program developed on W2K with Office
2K,
> >and the latest MDAC, will run OK on other flavours of Windows.
>
> FWIW, my test programs works OK on a W2K/SP1 box with no MS Office
> installation, and on a W98SE box with MS Office 97 installed.
> Microsoft.Jet.OLEDB.4.0 allows me to write to a .mdb file created by MS
> Access 97.
>
Now this is good to hear.

> I haven't updated the MDAC, and I'm not sure how I can tell what version
> I'm using. I'm told that you can ship the latest MDAC with your
> software, but I'd like to get some definitive advice on this before
> risking a lawsuit from M$!
>
I'm pretty sure you can.  After all, they supply an "MDAC redistributable"
with MS VC (I have the enterprise edition of VS 6.0), and they talk about
redistributing MDAC on their MDAC website.

> Going back a few steps...
> Ted Byers <r.ted.byers@sympatico.ca> writes
> >because the user has the
> >liberty to create as many database files as he likes, and I have to
create
> >the correct structure for each database he creates.  (My application
comes
> >with one database that is read only, and can create two kinds of database
> >for user data, one of which is unique and the other can be represented in
as
> >many files as the user wishes, which will depend on how the user
conceives
> >of relationships in his data - imagine a folder full of such files as
> >representing a bookshelf full of recipe books).
>
> Can the user query a whole string of .mdb files? If so, what's the best
> way to get that to work?
>
Yes, but not in a single query (at least as far as I know right now).  What
I'm considering is wrapping all the ADO\ADOX stuff in one of my own classes
and then representing each mdb file with an instance of this class.  Then,
in the datamodel, have containers for each of the kinds of data to be drawn
from the database files, and then when it is appropriate to submit a given
query to several mdb files, create a function object and use one of the STL
generic functions to apply the function to each database object in the
container.  Of course, with this in mind, the function object will have a
data member that will take the data from each query to each database, and it
will provide a function to add the contains of that data member to the
global data model at the appropriate time (with or without removing previous
contents of that container in the global data model - which will depend on
what makes sense in the context of the transfer).   I can see I am going to
have to do some detailed analysis to find which option makes the most sense
and gives the best performance, as I see now that the option I describe here
is only one of many possibilities.  I have had more than one mdb file open
at a time without a problem.

For now, if you want to pursue this, I'd suggest you make a database class
that has all the ADO stuff, with member functions for retrieving record sets
from, and for submitting properly formed SQL statements to, the database
(along with checks to ensure the operation requested is valid).  Of course,
a critical data member will be the connection string.  This would be the
first level in the class.  I can see a next level in which a class derived
from the class I just suggested provides functions for extracting data from
record sets and transfering it to conventional typed variables.  As
conceived in this way, the base class knows nothing about the structure of
the database, and merely handles creating or opening the database and
passing SQL statements to it, and getting record sets from it as
appropriate; after all, it knows nothng about what is in the SQL statements
it is passing to the database.  The derived class then has the
respondibility for processing record sets obtained from the database, and
since it is reasonable for the derived class to know the details of the
structure of the database, it could conceivably have responsibility for
creating, and passing to the database via the base class, the SQL statements
required to efficiently use the database.

I just downloaded the "Oracle, Odbc and DB2-CLI Template Library, Version
4.0" library.  It is freeware, so you would be well advised to get and study
it (http://otl.sourceforge.net/).  It doesn't explicitly support MS Access,
but since it supports ODBC, it should work with it.  I think I will be
studying this in my efforts to analyse my other DB issues.  I'll be studying
this along with SQLAPI++ to see if I can avoid making my own class by using
either of these libraries.  It would be useful to be able to manipulate some
databases as if they were objects, but I don't know yet if either library
supports such a concept yet.
Technical Details
Message-ID: <3fcfd9ae$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <vIB+nCAzsMz$IwBT@courtlands.demon.co.uk> <3fccec42$1@newsgroups.borland.com> <rUI$wAAUogz$IwA9@courtlands.demon.co.uk> <3fce1ab8@newsgroups.borland.com> <0x0o5DAm3lz$Iww1@courtlands.demon.co.uk> <3fcea31a$1@newsgroups.borland.com> <3fcf8077@newsgroups.borland.com> <3fcf86dc$1@newsgroups.borland.com> <u+Ye6EAXs6z$Iwiq@courtlands.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,3afd7f6873225c1f
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-12-04 17:09:38 PST
From: "Ted Byers" <r.ted.byers@sympatico.ca>
Newsgroups: borland.public.cppbuilder.database.ado
References: <vIB+nCAzsMz$IwBT@courtlands.demon.co.uk> <3fccec42$1@newsgroups.borland.com> <rUI$wAAUogz$IwA9@courtlands.demon.co.uk> <3fce1ab8@newsgroups.borland.com> <0x0o5DAm3lz$Iww1@courtlands.demon.co.uk> <3fcea31a$1@newsgroups.borland.com> <3fcf8077@newsgroups.borland.com> <3fcf86dc$1@newsgroups.borland.com> <u+Ye6EAXs6z$Iwiq@courtlands.demon.co.uk>
Subject: Re: Accessing highest auto number
Date: Thu, 4 Dec 2003 20:00:34 -0500
Lines: 90
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 65.95.242.19
Message-ID: <3fcfd9ae$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1070586286 65.95.242.19 (4 Dec 2003 17:04:46 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail