ADO and COM contants

Roger Upole rupole at hotmail.com
Sat Feb 28 17:00:33 EST 2004


You'll need to use makepy for the ADO library.
Once you create an instance of the object, the constants will
appear in win32com.client.constants, and then the code would
look like
   cmdQuery.CommandType = win32com.client.constants.adCmdStoredProc

For null parameters, most of the time you can use None and win32com will
do the right thing.

   hth
      Roger

"Boba" <b.ambrosius at hccnet.nl> wrote in message
news:403e4207$0$12847$3a628fcd at reader1.nntp.hccnet.nl...
> Hi,
> I'm using python as the language in ASP pages to query a database ussing
the
> com interface. I want to do a parameter query and I have to use constants
> like Null and Nothing. Does anyone know how to use the constants in
Python?
>
> Part of the code:
> #------------------
>  cmdQuery = win32com.client.Dispatch("ADODB.Command")
>  cmdQuery.ActiveConnection = cnn
>  cmdQuery.CommandText = "aStoredQuery"
>  cmdQuery.CommandType = adCmdStoredProc
>
>  # parameter: startdate
>  qryParm = win32com.client.Dispatch("ADODB.Parameter")
>  qryParm.Name = "parDateStart"
>  qryParm.Type = adDBDate
>  tmpDate =
> req.documentElement.selectSingleNode("//request_parDatBegin").text
>  qryParm.Value = Null  # at least sometimes
>  cmdQuery.Parameters.Append(qryParm)
> #---------------
> end code
>
> Bob
>
>





More information about the Python-list mailing list