473,385 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ADO and COM contants

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
Jul 18 '05 #1
2 2164
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.*********@hccnet.nl> wrote in message
news:40***********************@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

Jul 18 '05 #2
Roger,

Thanks. You gave me more answer than I'd asked for. I think I solved the
problem with the
constants by adjusting the adovbs.inc file so that it contains constants
that python
understands. But there is no Null and no Nothing constant. I'll try your
suggestion
and use None.
Douglas Savitsky mailed me saying that they should show up as
win32com.client.constants.Null
and win32com.client.constants.Nothing. At least the should be in the file
that makepy
generates. They don't.

Bob Ambrosius
Roger Upole <ru****@hotmail.com> schreef in berichtnieuws
40********@127.0.0.1...
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.*********@hccnet.nl> wrote in message
news:40***********************@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


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bryan Harrington | last post by:
I'm working on an application that I will make use of "constants". I put contants in quotes becuase they will change periodically (Logo path, css path, psw expiration times etc). From a system...
0
by: Sparmar2000 | last post by:
Hi I have another question. The following works but.... Code: Dim en As Object = USERROLEFieldIndex.ROL_IDENTIFIER SelectFilter.Add(PredicateFactory.CompareRange(en, arrlngUsersToGet)) I...
1
by: Steve Lilley | last post by:
Hello Can anyone help me with the following ? I have a table like this.... User_ID User_name User_email 1 Steve stelil@test.com
3
by: Jerry | last post by:
Hi, I found an enum type, for example: enum Alignment { Top, Bottom } is derived Enum, but Enum is a struct. However,
3
by: moondaddy | last post by:
How can I create a public variable similar to an Enum, but rather than returning integer values it would return String values? -- moondaddy@nospam.com
7
by: dwg1011 | last post by:
I have a global class GClass with 2 contants. Both are declared public in the form: PUBLIC Const Const1 = "xxx". When I try to use the constant as a default value (see code excerpt below) the...
6
by: wingphil | last post by:
Hi there, I have a shared method in a base class, and I need to know which subclass it has been called from. So for example Public Mustinherit Class BaseClass Public Shared Sub SharedMethod...
2
by: MikeB | last post by:
Hello All, how can I set my selectparameter to a constant value within my constants class or to a value in my web.config file?
1
Fary4u
by: Fary4u | last post by:
Hi i'm trying to design the picture gallery ever thing works fine but whn i've make test movie or export the swf file it's runs fine but problme i'm using this with in movie clip & i think...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.