Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Problem using Procedure(SQL Server) with ASP


Message #1 by "Sukhvinder Singh" <sukhi_soodan@y...> on Fri, 10 Aug 2001 13:32:40
Please help me to get the bug out,I am writting Procedure(sql Server),ASP 

code & the generated error.



>>> Procedure>>>>>>>....



CREATE PROCEDURE [SSServiceReport] @TD Varchar

AS

SELECT Tec_Log.RecDate, Tec_Log.UnitHardDown, 

    Tec_Problem.[Desc], Tec_Problem_Items.DescSub, 

    Tec_Log.TerminalID 

FROM Tec_Problem RIGHT OUTER JOIN

    Tec_ProblemLog RIGHT OUTER JOIN

    Tec_Log ON 

    Tec_ProblemLog.Class = Tec_Log.Id LEFT OUTER JOIN

    Tec_Problem_Items ON 

    Tec_ProblemLog.ProblemSubID = Tec_Problem_Items.Id ON 

    Tec_Problem.Id = Tec_ProblemLog.ProblemId

Where Tec_log.[TerminalID]=@TD

ORDER BY

    Tec_ProblemLog.ProblemTimeLog desc

..................................................................>>cont>>

>>>>>ASP Coding>>>>>>>>>>>>>>>>>>>>>...





<%

dim TD

TD="LC000803"

dim objConn3 

dim objTerminal3

dim objProcess

dim objParam

dim objComm

dim strSQL3

dim objRS

dim RowPos

RowPos=true

set objConn3 = Server.CreateObject("ADODB.Connection")

	objConn3.ConnectionString = "driver={SQL 

SERVER};server=soodan;uid=;pwd=;database=Thalamis"

	objConn3.Open





set objTerminal3 = Server.CreateObject("ADODB.Command")

objTerminal3.CommandText="SSServiceReport"

objTerminal3.Parameters.Delete(0)

set objParam=objTerminal3.CreateParameter

("TD",adVarChar,adParamInput,15,"LC000803")

objTerminal3.Parameters.Append objParam

objTerminal3.CommandType = adCmdStoredProc

objTerminal3.ActiveConnection = objConn3

set objProcess=Server.CreateObject("ADODB.Recordset")

objProcess.Open objTerminal3, ,adOpenStatic



Response.Write"<Center>"

dim strTable3

strTable3= "<TABLE BORDER=0 CELLSPACING=0 CELLPADING=0 > & width=80 "& "%" 

& ">" &_

            "<CAPTION align=left><B>SALES AGENT INFORMATION</B></CAPTION>" 

& _

            "<TR bgcolor=silver><TD align=Center><Font 

size=2><b><step#></b></TD>"&_

            "<TD><FONT SIZE=2><B>Opening Date/Time</B></TD>" & _

            "<TD><FONT SIZE=2><B>Problem Description</B></TD>" & _

            "<TD><FONT SIZE=2><B>Sub Problem Description</B></TD>" & _

            "<TD><FONT SIZE=2><B>Unit Hard Down</B></TD>" 

                  

While Not objProcess.EOF

        if RowPos then

             strTable3=strTable3&"<TR valigh=top bgcolor=#dddddd>"

         else

             strTable3=strTable3&"<TR valigh=top bgcolor=#ffffff>"

        end if   

   strTable3=strTable3 &_

     "<TD><FONT SIZE=2> " & FormatDateTime(objProcess("RecDate"),1) 

& "</TD>" & _ 

     "<TD><FONT SIZE=2> " & objProcess("Desc") & "</TD>" & _ 

     "<TD><FONT SIZE=2> " & objProcess("DescSub") & "</TD>" & _ 

     "<TD><FONT SIZE=2> " & objProcess("UnitHardDown") & "</TD>" 

objProcess.MoveNext

if RowPos then

 RowPos=false

   else

 RowPos=True

end if



Wend



strTable3=strTable3& "</TABLE>"     

Response.write strTable3

Response.write "<HR>"

Response.write "</CENTER>"

Response.write "<br>"

  

%>



..............................................................>>cont>>







>>>>>>>>The Error i am getting when i run my asp page>>>>>>



Error Type:

ADODB.Parameters (0x800A0CC1)

Item cannot be found in the collection corresponding to the requested name 

or ordinal



.....................................................END



ANY SUGGESTION AT THE EARLIEST WOULD BE APPRICIATED.



THANKS



Message #2 by "Gerhard Wentink" <data@w...> on Sat, 11 Aug 2001 07:40:37 +0200
This error most of the time means that you try to reference a column that

does not exist.

Did you check if the stored procedure returns the wanted result set if you

run it in the Query Analyzer?



Regards,



Gerhard Wentink

----- Original Message -----

From: "Sukhvinder Singh" <sukhi_soodan@y...>

To: "ASP components" <asp_components@p...>

Sent: Friday, August 10, 2001 1:32 PM

Subject: [asp_components] Problem using Procedure(SQL Server) with ASP





> Please help me to get the bug out,I am writting Procedure(sql Server),ASP

> code & the generated error.

>

> >>> Procedure>>>>>>>....

>

> CREATE PROCEDURE [SSServiceReport] @TD Varchar

> AS

> SELECT Tec_Log.RecDate, Tec_Log.UnitHardDown,

>     Tec_Problem.[Desc], Tec_Problem_Items.DescSub,

>     Tec_Log.TerminalID

> FROM Tec_Problem RIGHT OUTER JOIN

>     Tec_ProblemLog RIGHT OUTER JOIN

>     Tec_Log ON

>     Tec_ProblemLog.Class = Tec_Log.Id LEFT OUTER JOIN

>     Tec_Problem_Items ON

>     Tec_ProblemLog.ProblemSubID = Tec_Problem_Items.Id ON

>     Tec_Problem.Id = Tec_ProblemLog.ProblemId

> Where Tec_log.[TerminalID]=@TD

> ORDER BY

>     Tec_ProblemLog.ProblemTimeLog desc

> ..................................................................>>cont>>

> >>>>>ASP Coding>>>>>>>>>>>>>>>>>>>>>...

>

>

> <%

> dim TD

> TD="LC000803"

> dim objConn3

> dim objTerminal3

> dim objProcess

> dim objParam

> dim objComm

> dim strSQL3

> dim objRS

> dim RowPos

> RowPos=true

> set objConn3 = Server.CreateObject("ADODB.Connection")

> objConn3.ConnectionString = "driver={SQL

> SERVER};server=soodan;uid=;pwd=;database=Thalamis"

> objConn3.Open

>

>

> set objTerminal3 = Server.CreateObject("ADODB.Command")

> objTerminal3.CommandText="SSServiceReport"

> objTerminal3.Parameters.Delete(0)

> set objParam=objTerminal3.CreateParameter

> ("TD",adVarChar,adParamInput,15,"LC000803")

> objTerminal3.Parameters.Append objParam

> objTerminal3.CommandType = adCmdStoredProc

> objTerminal3.ActiveConnection = objConn3

> set objProcess=Server.CreateObject("ADODB.Recordset")

> objProcess.Open objTerminal3, ,adOpenStatic

>

> Response.Write"<Center>"

> dim strTable3

> strTable3= "<TABLE BORDER=0 CELLSPACING=0 CELLPADING=0 > & width=80 "& "%"

> & ">" &_

>             "<CAPTION align=left><B>SALES AGENT INFORMATION</B></CAPTION>"

> & _

>             "<TR bgcolor=silver><TD align=Center><Font

> size=2><b><step#></b></TD>"&_

>             "<TD><FONT SIZE=2><B>Opening Date/Time</B></TD>" & _

>             "<TD><FONT SIZE=2><B>Problem Description</B></TD>" & _

>             "<TD><FONT SIZE=2><B>Sub Problem Description</B></TD>" & _

>             "<TD><FONT SIZE=2><B>Unit Hard Down</B></TD>"

>

> While Not objProcess.EOF

>         if RowPos then

>              strTable3=strTable3&"<TR valigh=top bgcolor=#dddddd>"

>          else

>              strTable3=strTable3&"<TR valigh=top bgcolor=#ffffff>"

>         end if

>    strTable3=strTable3 &_

>      "<TD><FONT SIZE=2> " & FormatDateTime(objProcess("RecDate"),1)

> & "</TD>" & _

>      "<TD><FONT SIZE=2> " & objProcess("Desc") & "</TD>" & _

>      "<TD><FONT SIZE=2> " & objProcess("DescSub") & "</TD>" & _

>      "<TD><FONT SIZE=2> " & objProcess("UnitHardDown") & "</TD>"

> objProcess.MoveNext

> if RowPos then

>  RowPos=false

>    else

>  RowPos=True

> end if

>

> Wend

>

> strTable3=strTable3& "</TABLE>"

> Response.write strTable3

> Response.write "<HR>"

> Response.write "</CENTER>"

> Response.write "<br>"

>

> %>

>

> ..............................................................>>cont>>

>

>

>

> >>>>>>>>The Error i am getting when i run my asp page>>>>>>

>

> Error Type:

> ADODB.Parameters (0x800A0CC1)

> Item cannot be found in the collection corresponding to the requested name

> or ordinal

>

> .....................................................END

>

> ANY SUGGESTION AT THE EARLIEST WOULD BE APPRICIATED.

>

> THANKS

>


  Return to Index