Open a windows database file with a path name?

Nomad nomad*** at ***freemail.absa.co.za
Wed Nov 14 10:43:32 CET 2001


On 10 Nov 2001 01:59:22 -0800, osuchw at ecn.ab.ca (waldekO) wrote:

>Nomad <nomad***@***freemail.absa.co.za> wrote in message news:<qnonuto5ao5iu4c0fa1ttletlje3s9sfck at 4ax.com>...
>> Hi,
>> 
>> Is there anyway that I can open a database (MSAccess in this case)
>> using the path and file name rather than a DSN?  I can't seem to get
>> it to work.
>> 
>> TIA
>
>try this:
>
>>>> from win32com.client import Dispatch, constants
>>>> eng = Dispatch('DAO.DBEngine.36')
>>>> db = eng.OpenDatabase('c:/db1.mdb')
>>>> rs = db.OpenRecordset('select * from tblHolidays')
>>>> rs.Fields('ID').Value
>1
>>>> rs.MoveNext()
>>>> rs.Fields('ID').Value
>2

Cheers, That's pretty much what I was looking for, but I think I'll go
for the ADO version sent by Bill Bell.

Thanks anyway.

-- 
Nomad

Wondering of the vast emptyness of the 'net
in search of something cool.



More information about the Python-list mailing list