SP Command Error

M

Mangler

I a running a SP and calling it through ASP. I keep getting this
error:

Parameter object is improperly defined. Inconsistent or incomplete
information was provided.


I think I have the format of the date wrong somewhere. Can someone
help?

Here is the command:

<%

Dim spDup__rma
spDup__rma = ""
if(Request.Form("hdnrma") <> "") then spDup__rma =
Request.Form("hdnrma")

Dim spDup__model
spDup__model = ""
if(Request.Form("hdnmodel") <> "") then spDup__model =
Request.Form("hdnmodel")

Dim spDup__part
spDup__part = ""
if(Request.Form("part") <> "") then spDup__part = Request.Form("part")

Dim spDup__qty
spDup__qty = ""
if(Request.Form("hdnqty") <> "") then spDup__qty = Request.Form("qty")

Dim spDup__date
spDup__date = ""
if(Request.Form("btdate") <> "") then spDup__date =
Request.Form("btdate")

%>
<%

set spDup = Server.CreateObject("ADODB.Command")
spDup.ActiveConnection = MM_connReclaim_STRING
spDup.CommandText = "dbo.dup"
spDup.Parameters.Append spDup.CreateParameter("@RETURN_VALUE", 3, 4)
spDup.Parameters.Append spDup.CreateParameter("@rma", 200,
1,15,spDup__rma)
spDup.Parameters.Append spDup.CreateParameter("@model", 200,
1,15,spDup__model)
spDup.Parameters.Append spDup.CreateParameter("@part", 200,
1,5,spDup__part)
spDup.Parameters.Append spDup.CreateParameter("@qty", 200,
1,15,spDup__qty)
spDup.Parameters.Append spDup.CreateParameter("@date", 135,
1,30,spDup__date)
spDup.Parameters.Append spDup.CreateParameter("@result", 200, 2)
spDup.CommandType = 4
spDup.CommandTimeout = 0
spDup.Prepared = true
spDup.Execute()
spDupResult = spDup("@result")

%>


The format of the date going to the SP is ......
FormatDateTime(Now,2) .......
The format of the date in the SP is ................ smalldatetime
...........................

Everything inserts to the DB fine with the above 2 formats together but
it seems to be thowing the SP command off.
 
B

Bob Barrows [MVP]

Mangler said:
I a running a SP and calling it through ASP. I keep getting this
error:

Parameter object is improperly defined. Inconsistent or incomplete
information was provided.


I think I have the format of the date wrong somewhere. Can someone
help?

See this:
http://classicasp.aspfaq.com/date-t...ion/could-i-get-a-little-help-with-dates.html


Using parameters, you should not be attempting to apply a format. You
should be supplying a date as a date, not as a string which is what is
returned by formatdatetime). Do this:
spDup__date =CDate(spDup__date )


Also, see this for an easier technique for passing parameter values:
http://groups.google.com/group/microsoft.public.inetserver.asp.general/msg/5d3c9d4409dc1701?hl=en
 
M

Mangler

spDup.Parameters.Append spDup.CreateParameter("@result", 200, 2)


Forget I said anything, had a brain fart and forgot to put the size of
the output. Changed the above to:

spDup.Parameters.Append spDup.CreateParameter("@result", 200, 2,3)

and all is well....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,078
Latest member
MakersCBDBlood

Latest Threads

Top