Re: Connecting to Access datafile by Anders
Anders
Fri May 21 16:21:30 CDT 2004
Prashant
If you have created a DSN called ADBC that point to you database the use
either
h = SQLCONNECT('ABCD')
or
h = SQLSTRINGCONNECT('DSN=ABCD')
If you hace no DSN you can make a DSN-less connection with :
h = SQLSTRINGCONNECT("DRIVER Microsoft Access Driver (*.mdb); "+;
"DBQ=C:\IFA\ABCD.mdb;Uid=;Pwd=;")
I have made cut the long connection string into two strings: "DRIVER... "+
"DBQ ... "
You missed a the DRIVER keyword.
-Anders
"Prashant" <prashantpsoft@rediffmail.com> wrote in message
news:4F7F8C29-2BD6-4418-8014-60C8060DD176@microsoft.com...
> Hi Carsten,
>
> Thanks for a quick reply.
> I did:
> lnHandle= SQLStringConnect("{Microsoft Access Driver;
> (*.mdb)};Dbq=C:\IFA\ABCD.mdb;Uid=;Pwd=;")
>
> Now : a dialogue box appears. Its heading is "Select Data Source". It has
a pageframe having 2 pages. 1st page:File Data source, 2nd Page:Machine Data
Source.
>
> Anything wrong with the command I wrote above?
>
> Thanks.
> Prashant.
>
>
>
>
>
> ----- Carsten Bonde wrote: -----
>
> Prashant,
>
> there are several ways to get data from Access.
>
> I don't have MS Access installed on the pc right now, but from the
top of my
> head it should go something like this:
>
> <snip>
> local lnHandle as integer
>
> Note: Fill in your MDB-File
> lnHandle= SQLStringConnect("Driver={Microsoft Access Driver
> (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;")
> Note: If it fails, try with the string:
> Note: "{Microsoft Access Driver
> (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;"
>
> ? SQLExec( lnHandle, "select * from TableInMDB", "curResult" )
> SQLDisconnect( lnHandle)
> <snip>
>
> You recieve a cursor named "curResult" with the records.
>
> Other ways could be ADO or Automation.
>
> Cheers
> Carsten
>
>
> "Prashant" <prashantpsoft@rediffmail.com> schrieb im Newsbeitrag
> news:0D4C0F37-6753-400E-8DBB-4F4957C53873@microsoft.com...
> > Hi,
> > How to connect to Microsoft Access data file to pull data from it.
> >> TIA.
> >