
Hit Access 2.0 DB via ODBC (VB4)
Quote:
> >I'm trying to write an app that may hit any of several backends... so
> >ODBC is the only route I can go. What I'd like to do is hit an Access
> >2.0 database in the interrim via ODBC for testing purposes, and while
> >I know this is possible, I can't seem to figure out how it's done...
> >Without going into too much detail, what do I need to do in order to
> >set up the ACC2.0 DB as the ODBC backend supporting the VB4
> >application?
> >Thanks in advance!
> >Phil Sauer
> You can't do it. VB Supports Access directly but it doesn't let you do
> it using ODBC. I have tried this in the past and never got it to work
> and reading through the manuals, this is the answer I came up with. I
> also just gave it a shot with VB 4 and Access 2 and it didn't work.
> Luis
I, too, have come to this conclusion. To be strictly accurate, you
*can* access(!) access databases programatically via ODBC with vb4
(& vb3), but to do so you have to do it *all*, specifically with the
SQL functions & procedures exported by odbc32.dll (and, in 16 bits,
odbc.dll - they're identical, callwise). The ODBC SDK shows you how,
with a VB sample. Naturally this involves all the unpleasantness with
importing DLL interfaces via declare statements etc, but it isn't
*too* daunting.
But assuming that what was really intended by the question was 'is
it possible to open an access database via odbc using the DatabaseName
property of the data control, using an ODBC;DSN=whatever;UID=whoever
string in the way the parameter description for OpenDatabase says it
can be, so that you can abstract from the location of your .mdb file
by setting it up as an odbc data source?' - and the answer to this
question does seem to be no. Naturally the manuals and documentation
make no mention of this.
This is _really_ _terribly_ _annoying_.
I mean, what's the point of having odbc, and an odbc compliant database
like ms-access, and a rapid prototyping system like VB, if you can't use it?
All I need is for OpenDatabase to return me a VB Database object, using
that ODBC spec rather than a hardwired mdb filename (OK, so I can store that
in the registry and read it at run time, etc, etc) but I mean to say blah
blah blah how hard can it be blah blah blah? Mutter. Grumble.
Unless of course somebody knows different?
--
-------------------------------------------------------------------
BB 74 A4 EF 03 F8 44 C1 F3 75 FE C6 7E F9 6E 43 --- at home
-------------------------------------------------------------------