[python-win32] setting ADO page size property

Wilbert, Matt (ENV) Matt.Wilbert at state.ma.us
Sun May 18 16:00:14 EDT 2003


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