N
.Net Sports
I need to call an stored procedure from an asp script, I don't need to
do an Output parameter, only input parameters on 3 vars, but I get a
"BOF EOF not true or record has been deleted" error when trying to
call the page with the correct querystrings. The stored procedure
looks like it's properly called , as i tried misspelling the stored
procedure in the "CmdSP.CommandText = "resultsSP" " line, and the
error prompted no such stored procedure. The connection string is
correct:
'''''''''
<% Dim countyQ,stateQ,categQ
countyQ = request.querystring("county")
stateQ = request.querystring("state")
categQ = request.querystring("category")
%>
<%
Dim CmdSP
Dim rset
Dim adCmdSPStoredProc
Dim adParamReturnValue
Dim adParaminput
Dim adParamOutput
Dim adInteger
Dim iVal
Dim oVal
Dim adoField
Dim adVarChar
adCmdSPStoredProc = 4
adParamReturnValue = 4
adParaminput = 1
adParamOutput = 2
adInteger = 3
adVarChar = 200
iVal = 5
oVal = 3
Set CmdSP = Server.CreateObject("ADODB.Command")
CmdSP.ActiveConnection = conn
CmdSP.CommandText = "resultsSP"
CmdSP.CommandType = adCmdSPStoredProc
'-- define the first parameter - the one the procedure will return
'-- the calls are:
'-- CmdSP.Parameters.Append: append this parameter to the
collection for this command object
'-- CmdSP.CreateParameter(): creates the parameter using the
values given:
'-- "@countyQ" is the name of the parameter for later reference
'-- adVarChar (value = 200) indicates this parameter is a
string datatype
'-- adParamInput (value = 1) indicates this parameter is for
input
'-- 20 is the size of the string in characters
'-- "M" is an arbitrary initial value for this parameter
CmdSP.Parameters.Append CmdSP.CreateParameter("@countyQ", adVarChar,
adParaminput, 40, "")
CmdSP.Parameters.Append CmdSP.CreateParameter("@stateQ", adVarChar,
adParaminput, 2, "")
CmdSP.Parameters.Append CmdSP.CreateParameter("@categQ", adVarChar,
adParaminput, 25, "")
Set rset = CmdSP.Execute
%>
<%If Not rset.BOF Then%>
<%
Do While Not rset.EOF%>
<br><%= rset("company") %><br>
<%= rset("city") %> <%= rset("state") %> <br>
<%= rset("phone") %><br>
<i><%= rset("descript") %> </i><br>
<% rset.MoveNext
Loop
%>
<%End If%>
''here is the sproc creation
CREATE PROCEDURE resultsSP
@countyQ varchar(40),
@stateQ varchar(2),
@categQ varchar(25)
AS
BEGIN
SELECT * FROM general WHERE county='" + @countyQ + "' and state='" +
@stateQ + "' and category='" + @categQ + "' order by company
end
'' the resulting error on the asp page in question:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
/auto-results.asp, line 0
'''''
TIA
netsports
do an Output parameter, only input parameters on 3 vars, but I get a
"BOF EOF not true or record has been deleted" error when trying to
call the page with the correct querystrings. The stored procedure
looks like it's properly called , as i tried misspelling the stored
procedure in the "CmdSP.CommandText = "resultsSP" " line, and the
error prompted no such stored procedure. The connection string is
correct:
'''''''''
<% Dim countyQ,stateQ,categQ
countyQ = request.querystring("county")
stateQ = request.querystring("state")
categQ = request.querystring("category")
%>
<%
Dim CmdSP
Dim rset
Dim adCmdSPStoredProc
Dim adParamReturnValue
Dim adParaminput
Dim adParamOutput
Dim adInteger
Dim iVal
Dim oVal
Dim adoField
Dim adVarChar
adCmdSPStoredProc = 4
adParamReturnValue = 4
adParaminput = 1
adParamOutput = 2
adInteger = 3
adVarChar = 200
iVal = 5
oVal = 3
Set CmdSP = Server.CreateObject("ADODB.Command")
CmdSP.ActiveConnection = conn
CmdSP.CommandText = "resultsSP"
CmdSP.CommandType = adCmdSPStoredProc
'-- define the first parameter - the one the procedure will return
'-- the calls are:
'-- CmdSP.Parameters.Append: append this parameter to the
collection for this command object
'-- CmdSP.CreateParameter(): creates the parameter using the
values given:
'-- "@countyQ" is the name of the parameter for later reference
'-- adVarChar (value = 200) indicates this parameter is a
string datatype
'-- adParamInput (value = 1) indicates this parameter is for
input
'-- 20 is the size of the string in characters
'-- "M" is an arbitrary initial value for this parameter
CmdSP.Parameters.Append CmdSP.CreateParameter("@countyQ", adVarChar,
adParaminput, 40, "")
CmdSP.Parameters.Append CmdSP.CreateParameter("@stateQ", adVarChar,
adParaminput, 2, "")
CmdSP.Parameters.Append CmdSP.CreateParameter("@categQ", adVarChar,
adParaminput, 25, "")
Set rset = CmdSP.Execute
%>
<%If Not rset.BOF Then%>
<%
Do While Not rset.EOF%>
<br><%= rset("company") %><br>
<%= rset("city") %> <%= rset("state") %> <br>
<%= rset("phone") %><br>
<i><%= rset("descript") %> </i><br>
<% rset.MoveNext
Loop
%>
<%End If%>
''here is the sproc creation
CREATE PROCEDURE resultsSP
@countyQ varchar(40),
@stateQ varchar(2),
@categQ varchar(25)
AS
BEGIN
SELECT * FROM general WHERE county='" + @countyQ + "' and state='" +
@stateQ + "' and category='" + @categQ + "' order by company
end
'' the resulting error on the asp page in question:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
/auto-results.asp, line 0
'''''
TIA
netsports