[python-win32] Re: setting ADO page size property
nugentm
nugentm at myrealbox.com
Tue May 20 15:15:58 EDT 2003
Thanks for the assistance. I cannot figure out how to use ADO. So, instead I
used:
import win32com.client
adoRecordset=win32com.client.Dispatch('ADODB.Recordset')
adoConnection=win32com.client.Dispatch('ADODB.Connection')
adoCommand=win32com.client.Dispatch('ADODB.Command')
It works great. Thanks again for the help.
Mike
----- Original Message -----
From: "Wilbert, Matt (ENV)" <Matt.Wilbert at state.ma.us>
To: <python-win32 at python.org>
Cc: <nugentm at myrealbox.com>
Sent: Sunday, May 18, 2003 3:00 PM
Subject: setting ADO page size property
It is true that the property name is 'Page size'. Also I don't know if it
works to set
it as a connection property--I set it as a command property, as in this
function:
def getComputerList(ldapString):
adoConnection = ADO.Connection()
adoCommand = ADO.Command()
adoRecordset = ADO.Recordset()
adoConnection.Provider = "ADSDSOObject"
adoConnection.Open()
if adoConnection.State != ADO.constants.adStateOpen:
return None
else:
command = "Select Name from \'%s\' where objectClass = 'Computer'" %
ldapString
adoCommand.ActiveConnection = adoConnection
adoCommand.CommandText = command
adoCommand.Properties(u'Page size').Value = 1000
adoRecordset.Open(adoCommand)
try:
adoRecordset.MoveLast()
count = adoRecordset.RecordCount
adoRecordset.MoveFirst()
except:
count = 0
computerList = []
for i in range(count):
computername = adoRecordset.Fields.Item("Name").Value
computerList.append(computername)
adoRecordset.MoveNext()
return computerList
Hope this helps,
Matt
More information about the Python-win32
mailing list