luis wrote: > Hi > I'm using activestate python 2.4 on win xp 2 ed. and Ms Access 2002 > (reading first http://starship.python.net/crew/bwilk/access.html) > I have writed the following code > > def append_from_Access(self): > try: > import ... > conn = win32com.client.Dispatch(r'ADODB.Connection') > DSN = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA > SOURCE=C:/Afile.mdb;" > conn.Open(DSN) > except Exception, inst: > ... > try: > sql_statement='SELECT * FROM Mytable' > rs = win32com.client.Dispatch(r'ADODB.Recordset') > rs.Open(sql_statement, conn, 1, 3) > while not rs.EOF: > id=rs.Fields(colName.Value) #colName, valid column name > ... > rs.MoveNext() > rs.Close() > conn.Close() > > except Exception, inst: > ... > > I'm using it for reading tables or queries in a mdb file. > With some mdb it works fine and return a no empty recordset, but with > others mdb files, the recordsets are void (opening the tables or > recorsets with Ms Access are not void). > Some help is welcome, > Thanks in advance > Luis
I don't know if it's the problem your asking about, but your rs.MoveNext() should be inside the while loop, no? Iain -- http://mail.python.org/mailman/listinfo/python-list