Solved

ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal.

Posted on 2006-07-20
4
1,719 Views
Last Modified: 2008-01-09
For the life of me, I can not figure out what's wrong with this code.

The error is supposed to be with thanks.asp at line 271. Thanks.asp Line 271 reads: rsAddBook.Fields("rep1sal") = rep1sal

Here is the relevant code segment:
<!------------------------------------->
<%
Dim adoCon                   'Holds the Database Connection Object
Dim rsAddBook            'Holds the recordset for the new record to be added to the database
Dim strSQL                  'Holds the SQL query for the database
dim strAll

Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DSN=gsf_registration"
Set rsAddBook = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tblParticipants;"
rsAddBook.CursorType = 2
rsAddBook.LockType = 3
rsAddBook.Open strSQL, adoCon
rsAddBook.AddNew

reserve = request.form("reserve")
inst = request.form("inst")
description = request.form("description")
address = request.form("address")
city = request.form("city")
state = request.form("state")
zip = request.form("zip")
website = request.form("website")
salutation = request.form("salutation")
fname = request.form("fname")
lname = request.form("lname")
title = request.form("title")
phone = request.form("phone")
fax = request.form("fax")
mail = request.form("mail")
rep1sal = request.form("rep1sal")
rep1fname = request.form("rep1fname")
rep1lname = request.form("rep1lname")
rep1title = request.form("rep1title")
rep2sal = request.form("rep2sal")
rep2fname = request.form("rep2fname")
rep2lname = request.form("rep2lname")
rep2title = request.form("rep2title")

rsAddBook.Fields("reserve") = reserve
rsAddBook.Fields("inst") = inst
rsAddBook.Fields("address") = address
rsAddBook.Fields("city") = city
rsAddBook.Fields("state") = state
rsAddBook.Fields("zip") = zip
rsAddBook.Fields("website") = website
rsAddBook.Fields("salutation") = salutation
rsAddBook.Fields("fname") = fname
rsAddBook.Fields("lname") = lname
rsAddBook.Fields("title") = title
rsAddBook.Fields("phone") = phone
rsAddBook.Fields("fax") = fax
rsAddBook.Fields("mail") = mail
rsAddBook.Fields("rep1sal") = rep1sal
rsAddBook.Fields("rep1fname") = rep1fname
rsAddBook.Fields("rep1lname") = rep1lname
rsAddBook.Fields("rep1title") = rep1title
rsAddBook.Fields("rep2sal") = rep2sal
rsAddBook.Fields("rep2fname") = rep2fname
rsAddBook.Fields("rep2lname") = rep2lname
rsAddBook.Fields("rep2title") = rep2title
rsAddBook.Fields("description") = description
rsAddBook.Fields("paid") = "No"
rsAddBook.Fields("publish") = "No"
rsAddBook.Fields("sentemail") = "No"
rsAddBook.Update


%>



The form from which it gets called reads:


<!------------------------------------->
<table width="90%" border=0 cellspacing=0 cellpadding=0 align=center>
<tr><td><p>
<form name="fRegistration" method="post" action="thanks.asp">
<CENTER><font color="#ff0000">*</font> = Required</CENTER>
<table border="0">
<tr><td width=500><font color="#ff0000">* </font>Institution:</td><td><input type="text" name="inst" size="90"><BR>
&nbsp;&nbsp;<sub>( PLEASE INDICATE HOW YOUR ORG NAME SHOULD APPEAR ON SIGN/PROGRAM)</sub></td></tr>
<tr>
<td valign='top'>Brief<br>Program(s)<br>Description:<br></td><td><textarea cols='46' rows='10' name='description'></textarea><p></td></tr>
<tr><td><font color="#ff0000">* </font>Program/Dept:</td><td><input type="text" name="program" size=60><BR></td></tr>
<tr><td><font color="#ff0000">* </font>Address:</td><td><input type="text" name="address" size=60><BR></td></tr>
<tr><td><font color="#ff0000">* </font>City:</td><td><input type="text" name="City" size=29><font color="#ff0000"> * </font> State: <select name='State'>
      <option value='AL'>AL</option>
      <option value='AK'>AK</option>
      <option value='AZ'>AZ</option>
      <option value='AR'>AR</option>
      <option value='CA'>CA</option>
      <option value='CO'>CO</option>
      <option value='CT'>CT</option>
      <option value='DE'>DE</option>
      <option value='FL'>FL</option>
      <option value='GA'>GA</option>
      <option value='HI'>HI</option>
      <option value='ID'>ID</option>
      <option value='IL'>IL</option>
      <option value='IN'>IN</option>
      <option value='IA'>IA</option>
      <option value='KS'>KS</option>
      <option value='KY'>KY</option>
      <option value='LA'>LA</option>
      <option value='ME'>ME</option>
      <option value='MD'>MD</option>
      <option value='MA'>MA</option>
      <option value='MI'>MI</option>
      <option value='MN'>MN</option>
      <option value='MS'>MS</option>
      <option value='MO'>MO</option>
      <option value='MT'>MT</option>
      <option value='NE'>NE</option>
      <option value='NV'>NV</option>
      <option value='NH'>NH</option>
      <option value='NJ'>NJ</option>
      <option value='NM'>NM</option>
      <option value='NY' selected>NY</option>
      <option value='NC'>NC</option>
      <option value='ND'>ND</option>
      <option value='OH'>OH</option>
      <option value='OK'>OK</option>
      <option value='OR'>OR</option>
      <option value='PA'>PA</option>
      <option value='RI'>RI</option>
      <option value='SC'>SC</option>
      <option value='SD'>SD</option>
      <option value='TN'>TN</option>
      <option value='TX'>TX</option>
      <option value='UT'>UT</option>
      <option value='VT'>VT</option>
      <option value='VA'>VA</option>
      <option value='WA'>WA</option>
      <option value='WV'>WV</option>
      <option value='WI'>WI</option>
      <option value='WY'>WY</option>
</select><font color="#ff0000"> * </font>Zip: <input type="text" name="Zip" size=2></td></tr>
<tr><td><font color="#ff0000">* </font>Website:</td><td><input type="text" name="website" size=60></td></tr>
<tr><td>&nbsp; Salutation:</td><td>
<select name='Salutation'>
<option value=""></option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option>
<option value="Dr.">Dr.</option>
<option value="Rev.">Rev.</option>
<option value="Fr.">Fr.</option>
<option value="Sr.">Sr.</option>
<option value="Sgt.">Sgt.</option>
</select><BR></td></tr>
<tr><td><font color="#ff0000">* </font>First Name:</td><td><input type="text" name="fname" size=60><BR></td></tr>
<tr><td><font color="#ff0000">* </font>Last Name:</td><td><input type="text" name="lname" size=60><BR></td></tr>
<tr><td><font color="#ff0000">* </font>Title:</td><td><input type="text" name="title" size=60><BR></td></tr>
<tr><td><font color="#ff0000">* </font>Phone:</td><td><input type="text" name="phone" size=27><font color="#ff0000"> </font> Fax: <input type="text" name="fax" size=23></td></tr>

<tr><td><font color="#ff0000">* </font>Email:</td><td><input type="text" name="mail" size=60><BR></td></tr>
      <tr><td>&nbsp;<p></td></tr>
<tr><td colspan="2">Representative(s) Attending:</td></tr>
<tr><td colspan="2">Representative 1.
<tr><td>Salutation:</td><td>
<select name='rep1sal'>
<option value=""></option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option>
<option value="Dr.">Dr.</option>
<option value="Rev.">Rev.</option>
<option value="Fr.">Fr.</option>
<option value="Sr.">Sr.</option>
<option value="Sgt.">Sgt.</option>
</select><BR></td></tr>
<tr><td>First Name:</td><td><input type="text" name="rep1fname" size=60><BR></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="rep1lname" size=60><BR></td></tr>
<tr><td>Title:</td><td><input type="text" name="rep1title" size=60><BR></td></tr>
<tr><td colspan="2">Representative 2.
<tr><td>Salutation:</td><td>
<select name='rep2sal'>
<option value=""></option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option>
<option value="Dr.">Dr.</option>
<option value="Rev.">Rev.</option>
<option value="Fr.">Fr.</option>
<option value="Sr.">Sr.</option>
<option value="Sgt.">Sgt.</option>
</select><BR></td></tr>
<tr><td>First Name:</td><td><input type="text" name="rep2fname" size=60><BR></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="rep2lname" size=60><BR></td></tr>
<tr><td>Title:</td><td><input type="text" name="rep2title" size=60><BR></td></tr>
<tr><td colspan="2">
<table border=0 width=80%><tr><td><hr><font color="#ff0000">*</font>
   <input type="radio" name="reserve" value="half"> Reserve a HALF TABLE (one representative only).  The $65 registration fee or purchase order will be sent.<p>
   <input type="radio" name="reserve" value="whole"> Reserve a WHOLE TABLE (up to two representatives).  The $100 registration fee or purchase order will be sent.<p>
   <input type="radio" name="reserve" value="No"> We will be unable to attend, but please keep us on your mailing list for future events.<p>
</font></td></tr></table><p>
</td></tr>
<tr><td colspan="2"><center>
<input type=button name="submitform" value="Submit Your Registration" onclick="javascript:validate()"></td></tr>
<tr><td colspan="2"><center><p><p>



</td></tr>
</table>


<!------------------------------------->

when loading I get the error: ADODB.Recordset (0x800A0CC1) Item cannot be found in the collection corresponding to the requested name or ordinal.

Any ideas what's wrong?
0
Comment
Question by:aumandg
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
ThinkPaper earned 500 total points
ID: 17148262
hmm... lets start out simple. Check your db field names .. do they all match?
comment out the line thats giving an error.. does everything else work?

also do
response.write request.form to make sure all your form values are going thru with no problems.
0
 
LVL 9

Expert Comment

by:jmanGJHS97
ID: 17148307
Can you post your SQL statement here, so we can see it?  Just response.write it to the screen, and then copy it here, so we can take a look.

You probably have a syntax error in there somewhere.  That error refers to the fact that it can't find a field with that name, which could be due to a database issue or an error in your SQL statement.

Which database are you using?

jmanGJHS97
0
 
LVL 9

Expert Comment

by:jmanGJHS97
ID: 17148322
Oh, I see now that you just do "SELECT * FROM tblParticipants;"

This tells me that you have an issue with the field named "rep1sal".  Are you sure that field is named correctly in your code?

jmanGJHS97
0
 

Author Comment

by:aumandg
ID: 17148485
d'ope... i was looking and looking and looking at the code. I had a typo in the db field name! Thanks!
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now