Can somebody help me ?

P

Patrick

Hi,

I managed to open a msaccess database with python.

import win32com.client.dynamic
db1 = win32com.client.dynamic.Dispatch("Access.Application")
dbname = "D:\\Project\\Database\\database.mdb"
db1.OpenCurrentDatabase(dbname)

Now, I have the problem, that I don't know how I can read the lines
of my table. Can somebody help me please and give me an example code ?

I'm looking forward to your answers, and thank u very much in advance.

Cheers

Patrick
 
R

Roger Upole

You should be able to get at the data with something like this:

cdb=db1.CurrentDb()
rs=cdb.OpenRecordset('yourtablename')
while not rs.EOF:
print rs.Fields(0)
rs.MoveNext()

hth
Roger
 
T

Tor Iver Wilhelmsen

import win32com.client.dynamic
db1 = win32com.client.dynamic.Dispatch("Access.Application")

As an aside: This looks like a good candidate for import aliasing

import win32com.client.dynamic as com
db1 = com.Dispatch("Access.Application")

Unless you like to type a lot. :)
 
B

beliavsky

Hi,

I managed to open a msaccess database with python.

You can help us by using an informative title such as "Open MSAccess
with Python?" instead of the generic "Can somebody help me?"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top