473,803 Members | 3,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error with Stored_Proc

Hi,

I am having a problem with a stored procedure. I am getting the
following error

ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

/myproofs/includes/functions.asp, line 183

I have higlighted line 183 with #######

FUNCTION addPublication( strName, dtCreationDate, dtDeadlineDate, blnOpen)

Dim objComm

set objComm = server.CreateOb ject("ADODB.Com mand")

objComm.activeC onnection = objConn
objComm.Command Text = "Insert_Add_Pub lication"
objComm.Command Type = adCmdStoredProc

objComm.Paramet ers.Append
objComm.CreateP arameter("@tblP ublicationName" ,
adVarChar,adPar amInput,50,strN ame)
objComm.Paramet ers.Append
######objComm.C reateParameter( "@tblPublicatio nCreationDate",
adDBDate,adPara mInput,4,dtCrea tionDate)
objComm.Paramet ers.Append
objComm.CreateP arameter("@tblP ublicationOpen" , adTinyInt,adPar amInput,
,blnOpen)
objComm.Paramet ers.Append
objComm.CreateP arameter("@tblP ublicationDeadL ine",
adDate,adParamI nput,4,dtDeadli neDate)

objComm.Execute

set objComm = nothing

END FUNCTION

Many thanks
for any help recieved.
Stuart
Jul 22 '05 #1
5 1791
stuart wrote:
Hi,

I am having a problem with a stored procedure. I am getting the
following error

ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

/myproofs/includes/functions.asp, line 183

I have higlighted line 183 with #######

FUNCTION addPublication( strName,
dtCreationDate, dtDeadlineDate, blnOpen)
Dim objComm

set objComm = server.CreateOb ject("ADODB.Com mand")

objComm.activeC onnection = objConn
Bad practice here. Always use Set when assigning an object to a variable or
property. Without the Set keyword, the default property of objConn (its
connection string) is assigned to ActiveConnectio n. This causes a new
connection to be implicitly created and opened when you execute the Command,
in effect, disabling session pooling.
objComm.Command Text = "Insert_Add_Pub lication"
objComm.Command Type = adCmdStoredProc

objComm.Paramet ers.Append
objComm.CreateP arameter("@tblP ublicationName" ,
adVarChar,adPar amInput,50,strN ame)
objComm.Paramet ers.Append
######objComm.C reateParameter( "@tblPublicatio nCreationDate",
adDBDate,adPara mInput,4,dtCrea tionDate)


1. The correct datatype constant to use is adDBTimeStamp
2. You need to verify that dtCreationDate actually contains a date. Use
CDate with error-handling to do this verification. If dtCreationDate
contains an empty string, you need to assign Null to the variable.
3. You don't have any output parameters that I can see, and you don't seem
to be interested in reading the return parameter, so you do not need an
explicit Command object., using the "stored-procedure-as-connection-method"
technique to execute your procedure instead. You can rewrite your function
as follows:

FUNCTION addPublication( strName, dtCreationDate, dtDeadlineDate, blnOpen)
' validate your inputs per step 2 above, then:
on error resume next
objConn.Insert_ Add_Publication strName, dtCreationDate, blnOpen, _
dtDeadlineDate
if err <> 0 then
'handle the error
end if
end function

I only use an explicit Command object when
a. I need to read the value of the return parameter
b. I need to use output parameters
c. both of the above

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Thanks Bob.

Bob Barrows [MVP] wrote:
stuart wrote:
Hi,

I am having a problem with a stored procedure. I am getting the
following error

ADODB.Comma nd error '800a0d5d'

Application uses a value of the wrong type for the current operation.

/myproofs/includes/functions.asp, line 183

I have higlighted line 183 with #######

FUNCTION addPublication( strName,
dtCreationDat e,dtDeadlineDat e,blnOpen)
Dim objComm

set objComm = server.CreateOb ject("ADODB.Com mand")

objComm.activ eConnection = objConn

Bad practice here. Always use Set when assigning an object to a variable or
property. Without the Set keyword, the default property of objConn (its
connection string) is assigned to ActiveConnectio n. This causes a new
connection to be implicitly created and opened when you execute the Command,
in effect, disabling session pooling.

objComm.Comma ndText = "Insert_Add_Pub lication"
objComm.Comma ndType = adCmdStoredProc

objComm.Param eters.Append
objComm.Creat eParameter("@tb lPublicationNam e",
adVarChar,adP aramInput,50,st rName)
objComm.Param eters.Append
######objComm .CreateParamete r("@tblPublicat ionCreationDate ",
adDBDate,adPa ramInput,4,dtCr eationDate)

1. The correct datatype constant to use is adDBTimeStamp
2. You need to verify that dtCreationDate actually contains a date. Use
CDate with error-handling to do this verification. If dtCreationDate
contains an empty string, you need to assign Null to the variable.
3. You don't have any output parameters that I can see, and you don't seem
to be interested in reading the return parameter, so you do not need an
explicit Command object., using the "stored-procedure-as-connection-method"
technique to execute your procedure instead. You can rewrite your function
as follows:

FUNCTION addPublication( strName, dtCreationDate, dtDeadlineDate, blnOpen)
' validate your inputs per step 2 above, then:
on error resume next
objConn.Insert_ Add_Publication strName, dtCreationDate, blnOpen, _
dtDeadlineDate
if err <> 0 then
'handle the error
end if
end function

I only use an explicit Command object when
a. I need to read the value of the return parameter
b. I need to use output parameters
c. both of the above

Bob Barrows

Jul 22 '05 #3
Bob Barrows [MVP] wrote:
objComm.activeC onnection = objConn


Bad practice here. Always use Set when assigning an object to a
variable or property. Without the Set keyword, the default property
of objConn (its connection string) is assigned to ActiveConnectio n.


And what does that imply WRT JScript (where there is no Set keyword) and
connection pooling?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #4
Dave Anderson wrote:
Bob Barrows [MVP] wrote:
objComm.activeC onnection = objConn


Bad practice here. Always use Set when assigning an object to a
variable or property. Without the Set keyword, the default property
of objConn (its connection string) is assigned to ActiveConnectio n.


And what does that imply WRT JScript (where there is no Set keyword)
and connection pooling?


If you check out the "Implicit Connections" thread started by Mark McGinty,
you will see me eating crow about this. It turns out that the Set keyword is
actually not needed in this situation for some reason. Somehow, the
ADODB.Command class is handling it the way it should be handled.

I do not believe this issue would have any bearing wrt jscript anyways,
since, as you say, there is no equivalent of a Set keyword in that language.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #5
Bob Barrows [MVP] wrote:
...Without the Set keyword, the default property of objConn
(its connection string) is assigned to ActiveConnectio n...


I do not believe this issue would have any bearing wrt jscript
anyways, since, as you say, there is no equivalent of a Set keyword
in that language.


And perhaps just as importantly, no default properties.

This group has been swimming in interesting performance-related threads
lately.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 22 '05 #6

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

Similar topics

2
4382
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two files containing some templates: adjacency_list.hpp and mem_fn.hpp can not compile. Does anyone have any solutions?
13
6621
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
5035
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying. I created the websetup and built the MSI, have the bundled version. Copied to webserver and ran Websetup.msi. Said I had to remove old version, which I did, then reran WebSetup.msi and keeps giving me this error. "The installer was interrupted...
2
19496
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge. I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
0
9699
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9562
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.