Using ADO in Python

Diego Barros alien at
Sat May 13 03:15:01 EDT 2000

I can create an ADODB.Recordset object and use it under Python. No
problem. But how do I use a recordset returned, for example, from

When I try something like:

import win32com.client

con = win32com.client.Dispatch("ADODB.Connection")
con.Open("Provider=SQLOLEDB.1;Password=password;Persist Security
Info=True;User ID=sa;Initial Catalog=Surefire;Data Source=ARMALYTE")
rs = win32com.client.Dispatch("ADODB.Recordset")
print rs.State
rs = con.Execute("SELECT * FROM Stock WHERE Stock_Unique_Id IS NULL")
print rs.State

I get the error:

Traceback (innermost last):
  File "F:\Code\Python\", line 8, in ?
    print rs.State
AttributeError: 'tuple' object has no attribute 'State'

The first "print rs.State" works, the second does not. 

Any help would be appreciated.

Diego Barros

More information about the Python-list mailing list