Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1800
  • Last Modified:

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

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
aumandg
Asked:
aumandg
  • 2
1 Solution
 
ThinkPaperCommented:
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
 
jmanGJHS97Commented:
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
 
jmanGJHS97Commented:
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
 
aumandgAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now