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,739 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IIS components 2 35
Debugging Html 8 32
Session on Html 8 42
StoredProcedure to JSON query faulty syntax 2 29
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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