SP Command Error

SP Command Error

am 22.01.2007 17:16:38 von 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.

Re: SP Command Error

am 22.01.2007 17:41:05 von reb01501

Mangler wrote:
> 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-time-routines-manipulation /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.a sp.general/msg/5d3c9d4409dc1701?hl=en
--
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.

Re: SP Command Error

am 22.01.2007 17:44:18 von 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....