You need to include adovbs.inc or, better yet, read this article for a
better approach:
[url]http://www.aspfaq.com/2112[/url]

--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]




"Sean" <S.Cairnsbelfasttelegraph.co.uk> wrote in message
news:AA346E11-FFC5-4D8F-9985-BAC84F8C9AECmicrosoft.com...
> Hey all, thanks for your help last time Bob, Im starting to get there
>
> Ive been given some great help with writing my asp to return the results
from a stored procedure. The stored procedure has one input parameter.
I've been re-writing my asp quite a lot and now i've become a little
confused because unfortunately im very new to coding. The following is my
asp code and below is the html code from my form.
> Ive been getting the following error message:
>
> (Microsoft VBScript runtime error '800a01f4'
> Variable is undefined: 'adCmdStoredProc'
> /testing.asp, line 23 )
>
> Does this mean my connection is at least worked. Does anyone know what
the problem is. When I comment that line out and refresh the page I got
another error: -
>
> (ADODB.Parameter error '800a0bb9'
> Arguments are of the wrong type, are out of acceptable range, or are in
conflict with one another.
> /testing.asp, line 28 )
>
> Could some please help me re-write this slightly in order to work. Im not
sure if I require all of the code in there. I commented out alot incase I
need it further down the line. I dont seem to have made reference to the
asp code in the html code. How is this done.
> Thank you so much for helping me im starting to really go nuts, but its
such a good feeling when it all works.
>
> <%
> Option Explicit
> 'if len(Request.form("ReportByPubClass2")) > 0 then
> 'login processing
> 'Connect to Database
> Dim sDate
> sDate = Request.Form("t_week_end_date")
> dim dbcn, dbrs, byclassnoprice
> Set dbcn = server.CreateObject("ADODB.Connection")
> set dbrs = server.CreateObject("ADODB.Recordset")
> Set byclassnoprice = server.CreateObject("ADODB.Command")
> dbcn.open Application ("connectionString")
> 'set the connection
> set byclassnoprice.ActiveConnection = dbcn
> 'create the command object
> byclassnoprice.CommandText = "ByClassPUBCLASS"
> 'create and append the input parameters
> 'byclassnoprice.CommandType = adCmdStoredProc
> 'set the name of the stored procedure
> Dim objParam, adDate
> set objParam = byclassnoprice.CreateParameter
> objParam.Name = "t_week_end_date"
> objParam.Type = adDate
> objParam.Direction = adParamInput
> objParam.Value = t_week_end_date.Text
>
> 'byclassnoprice.Parameters.Append byclassnoprice.CreateParameter
("t_week_end_date", adDate, adParamInput)
> 'set the initial value of the parameter
> 'byclassnoprice.Parameters ("t_week_end_date").Value =
t_week_end_date.Text
>
> 'call the stored procedure and save the results in a recordset
> dbrs = byclasspubclass.Execute
>
> dim sHTML
> if rs.eof then
> response.write "No records were returned"
> else
> Response.Write "<table border=1><tr><td>"
> sHTML=rs.GetString(2,,"</td><td>",_
> "</td></tr><tr><td>", "NA")
> sHTML = Left(sHTML, len(sHTML) - 8)
> response.Write sHTML
> response.write "</table>"
> End if
> dbrs.Close: set dbrs = nothing
> dbcn.close: set dbcn = nothing
>
> 'end if
> %>
>
> How does this form know how to run the asp code and return the recordset.
Do I need to make reference to it in here
>
> <form name="accounting" method="post"
action="displayreports.asp"><p>Please Enter a Weekending Date
> <input type="text" name="t_week_end_date"></p><p><input type="submit"
name="ReportByPubClass2" value="View Report"></p></form>