Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 21st, 2005, 11:10 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP problems please HELP...

I'm new to ASP and I desperately need help. I have 6 asp pages total. The last one I just added yesterday. I'm trying to pull data and display it on page 6, but it's coming from a different table (SQL 7 databases)than the previous page. Do I have to change the Recordset. Is it still using the Recordset from the previous page. I'm getting this error when I try to go from page 5 to 6. Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal. For line 81.

Here's 80 and 81.

While Not objRS2.EOF //80
strOutputString = strOutputString & "<tr align=center>" & _ //81

Here's the code from Page 5:

<body>

<form METHOD="POST" ACTION="pricing4.asp" id=form1 name=form1>

<form id=form1 name=form1>
  <table BORDER="0">
    <tr>
      <td width= 215><b>&nbsp; Part Description</b></td>
      <td>
    <%Response.Write(Request("prodgrp"))%>
    <input type="hidden" name="prodgrp" size=40 Value="<%=Request("prodgrp")%>"></td>
    </tr>
    <tr>
      <td><b>&nbsp; OEM Part Number</b></td>
      <td>
    <%Response.Write(Request("OEMPARTNUM"))%>
    <input TYPE="hidden" NAME="OEMPARTNUM" VALUE="<%=Request("OEMPARTNUM")%>"></td>
    </tr>
    <tr>
      <td><b>&nbsp; Customer</b></td>
      <td>
    <%Response.Write(Request("customer"))%>
    <input TYPE="hidden" NAME="customer" size=50 VALUE="<%=Request("customer")%>"></td>
    </tr>
  </table>
  <BR><BR>
  <table width = 100%>
    <tr>
      <td>&nbsp;</td>
      <td>
<%
dim objConn, objRS, strConnect
dim strSQL
dim strpart
dim strcust

Set objConn = Server.CreateObject ("ADODB.Connection")
Set objRS = Server.CreateObject ("ADODB.Recordset")

strpart=Request.Form("OEMPARTNUM")
strcust=Request.Form("customer")

strSQL = "SELECT * FROM vw_RepairPrice WHERE PartNumber = '" & strpart & " ' AND Name = '" & strcust & " '" & _
        "ORDER BY PartDescription"

objConn.Open strConnect
objRS.Open strSQL, objConn

strOutputString = "<table border=1 width =""100%"">" & _
    "<tr align=center>" & _
    "<td><b>Repair Description</b></td>" & _
    "<td><b>Comments</b></td>" & _
    "<td><b>Price</b></td>" & _
    "<td><b>TAT</b></td>" & _
    "<td><b>Sales Group</b></td>" & _
    "<td><b>QID/Contract #</b></td>" & _
    "</tr>"

While Not objRS.EOF
strOutputString = strOutputString & "<tr align=center>" & _
    "<td>" & objRS("RepairDescription")& "</td>" & _
    "<td>" & objRS("Comments")& "</td>" & _
    "<td>" & FormatCurrency(objRS("price"))& "</td>" & _
    "<td>&nbsp;" & objRS("tat")& "</td>" & _
    "<td>&nbsp;" & objRS("SalesGroup")& "</td>" & _
    "<td>" & objRS("QID")& "</td>" & _
    "</tr>"
objRS.MoveNext
Wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
Response.Write strOutputString

%></td>
    </tr>
  </table>
  <br>
  <INPUT TYPE="button" NAME="Go Back!" VALUE="Go Back" LANGUAGE="VBScript" OnClick="call window.history.back(1)">
  <input TYPE="Submit" value="Next" id=Submit1 name=Submit1>
</FORM>
<br><br><br><br><br><br>


Here's my code so far for unreachable Page 6:

<body>

<form METHOD="POST" ACTION="pricing4.asp" id=form1 name=form1>

<form id=form1 name=form1>
  <table BORDER="0">
    <tr>
      <td width= 215><b>&nbsp; Part Description</b></td>
      <td>
    <%Response.Write(Request("prodgrp"))%>
    <input type="hidden" name="prodgrp" size=40 Value="<%=Request("prodgrp")%>"></td>
    </tr>
    <tr>
      <td><b>&nbsp; OEM Part Number</b></td>
      <td>
    <%Response.Write(Request("OEMPARTNUM"))%>
    <input TYPE="hidden" NAME="OEMPARTNUM" size=40 VALUE="<%=Request("OEMPARTNUM")%>"></td>
    </tr>
    <tr>
      <td><b>&nbsp; Customer</b></td>
      <td>
    <%Response.Write(Request("customer"))%>
    <input TYPE="hidden" NAME="customer" size=50 VALUE="<%=Request("customer")%>"></td>
    </tr>
  </table>
  <BR><BR>
  <table width = 100%>
    <tr>
      <td>&nbsp;</td>
      <td>
 <%
dim objConn, objRS2, strConnect
dim strSQL, strOutputString
dim strpart
dim strcust

Set objConn = Server.CreateObject ("ADODB.Connection")
Set objRS2 = Server.CreateObject ("ADODB.Recordset")

strpart=Request.Form("OEMPARTNUM")
strcust=Request.Form("customer")

strSQL = "SELECT DISTINCT IEN FROM vw_IENNoDups WHERE Name = '" & strcust & " '" & _
        "ORDER BY IEN"

objConn.Open strConnect
objRS2.Open strSQL, objConn

strOutputString = "<table border=1 width =""500"">" & _
    "<tr align=center>" & _
    "<td><b>Customer</b></td>" & _
    "<td><b>All IENS</b></td>" & _

    "</tr>"

While Not objRS2.EOF
strOutputString = strOutputString & "<tr align=center>" & _
       "<td>" & objRS2("QID")& "</td>" &_
       "<td>" & objRS2("IEN")& "</td>" & _
    "</tr>"
objRS2.MoveNext
Wend



objRS2.Close
objConn.Close
Set objRS2 = Nothing
Set objConn = Nothing
Response.Write strOutputString


%>

</td>
    </tr>
  </table>
  <br>
  <INPUT TYPE="button" NAME="Go Back!" VALUE="Go Back" LANGUAGE="VBScript" OnClick="call window.history.back(1)">
  <input TYPE="Submit" value="Next" id=Submit1 name=Submit1>
</FORM>
<br><br><br><br><br><br>



<a href="mailto:amy.l.milligan@pw.utc.com">Mail Technical issues to MIS</a><br>
<a href="mailto:john.fuchs@pw.utc.com">Mail Price issues to Customer Service</a>
</body>
</html>

<P>&nbsp;</P>

</BODY>
</HTML>


Reply With Quote
  #2 (permalink)  
Old April 21st, 2005, 12:27 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Brian,

I think the error may be on the line
Code:
objRS2("QID")
as your query does not select a field of this name. try changing it to
Code:
"SELECT DISTINCT IEN, QID FROM vw_IENNoDups WHERE Name = '" & strcust & " '" & _
        "ORDER BY IEN"

HTH,

Chris

Reply With Quote
  #3 (permalink)  
Old April 21st, 2005, 12:53 PM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I changed all the objRS2s back to objRS. The QID field was coming from a table from the previous page. QID isn't a field in vw_IENNoDups. I was just testing to see if I could get something from my new table to display and something from the old table to display as well. I've since changed everything back to the way it was for my new page. My goal is really only to get IENs to display from vw_IENNoDups.

It looks like this now:

      <td>
 <%
dim objConn, objRS, strConnect
dim strSQL, strOutputString
dim strpart
dim strcust

Set objConn = Server.CreateObject ("ADODB.Connection")
Set objRS = Server.CreateObject ("ADODB.Recordset")

strpart=Request.Form("OEMPARTNUM")
strcust=Request.Form("customer")

strSQL = "SELECT DISTINCT IEN FROM vw_IENNoDups WHERE Name = '" & strcust & " '" & _
        "ORDER BY IEN"

objConn.Open strConnect
objRS.Open strSQL, objConn

strOutputString = "<table border=1 width =""500"">" & _
    "<tr align=center>" & _
    "<td><b>All IENS</b></td>" & _
    "<td><b>Customer</b></td>" & _


    "</tr>"


While Not objRS.EOF
strOutputString = strOutputString & "<tr align=center>" & _ //error
       "<td>" & objRS("IEN")& "</td>" &_
    "</tr>"
objRS.MoveNext
Wend



objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
Response.Write strOutputString
%>

</td>

Sorry about the confusion. I'm trying anything to get this to work.

TyVeryMuch,
B




Reply With Quote
  #4 (permalink)  
Old April 22nd, 2005, 03:07 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Brian,

Are you still getting the same error?

What value are you giving to strConnect? Looking at the above code, it seems to have no value, so I am surprised you are not getting an error when you try to open a connection using it.

Cheers,

Chris

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
logon.asp and validate .asp problems p2ptolu Classic ASP Basics 1 February 17th, 2005 12:33 AM
validate.asp problems and logon.asp problems p2ptolu Classic ASP Databases 0 February 16th, 2005 02:34 PM
New to ASP.NET w/ C# and having problems digitaltoddy BOOK: Beginning ASP.NET 1.0 1 September 20th, 2004 07:20 AM
ASP Problems vitanza BOOK: Beginning ASP 3.0 6 February 19th, 2004 11:00 PM
Problems with my ASP nvillare Classic ASP Basics 2 July 9th, 2003 03:11 PM



All times are GMT -4. The time now is 02:45 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.