Item cannot be found in the collection corresponding to the requested name or ordinal (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Meni -> Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 10:33:43)

Hello.
I have a site based on an access DB that was created entirely by FP.
I edited the table structure after creating the site.
Everything is working except for when i want to edit one of the entried...
This is the error i am getting:

Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
/test/_fpclass/fpdblib.inc, line 48

in my fpdblib.inc this is what I have:

(starting from line 48)

If Not IsEmpty(rs) And Not (rs Is Nothing) and Not IsNull(rs(fldname)) Then
Select Case rs(fldname).Type
Case 128, 204, 205 ' adBinary, adVarBinary, adLongVarBinary
FP_Field = "[#BINARY#]"
Case 201, 203 ' adLongVarChar, adLongVarWChar
if rs(fldname).DefinedSize > 255 then
' check for Access hyperlink fields (only absolute http links)
fp_strVal = rs(fldname)
fp_idxHash1 = InStr(LCase(fp_strVal),"#http://")
if fp_idxHash1 > 0 then
fp_idxHash2 = InStr(fp_idxHash1+1,fp_strVal,"#")
if fp_idxHash2 > 0 then
' this is an Access hyperlink; extract the URL part
fp_strVal = Mid(fp_strVal,fp_idxHash1+1)
if Right(fp_strVal,1) = "#" then
fp_strVal = Left(fp_strVal,Len(fp_strVal)-1)
end if
end if
end if
FP_Field = fp_strVal
else
FP_Field = rs(fldname)
end if
Case Else
FP_Field = rs(fldname)
End Select
Else
FP_Field = ""
End If


Please help me!




dpf -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 10:39:44)

quote:

I edited the table structure after creating the site.
that may be the problem




Meni -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 10:45:17)

ok...

the original table had:

firstName
lastName
address
homePhone
mobilePhone
dateOfBirth
aType
bType
fieldE
notes

and after editing the table I have:

firstName
lastName
address
homePhone
mobilePhone
dateOfBirthMonth
dateOfBirthDay

aType
bType
fieldE
notes


What do you suggest?




BeTheBall -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 12:26:16)

The error is not in fpdblib.inc, but rather in the page that performs the edit. Can you post the code for the page your edit form submits to?




Meni -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 15:15:17)

<%@ LANGUAGE="VBSCRIPT" %>
<html dir="rtl">
<head>
<title>Da Search Results!</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
<meta http-equiv="Content-Language" content="he">
</head>

<body>
<span dir="rtl">

<div align="center">
	<table border="0" cellpadding="0" cellspacing="0" width="724" height="240" id="table1">
		<!-- MSTableType="layout" -->
		<tr>
			<td valign="top" bgcolor="#ECECFF" height="100">
			<!-- MSCellType="ContentHead" -->
			<p align="center">
			<font color="#800080">
			<img border="0" src="../../../images/logo1.jpg" width="263" height="100"></font></td>
		</tr>
		<tr>
			<td valign="top" bgcolor="#ECECFF" height="115">
			<p align="center"><span dir="rtl">
			<font size="+3" color="#800080" face="Narkisim">
			<b><span lang="he">מערכת בקרת לקוחות - מספרת </span>NV</b></font></span></p>
			<p align="center">
	  <b><font face="Narkisim" size="4" color="#800080">טופס חיפוש לקוח</font></b><font size="4" color="#800080" face="Narkisim"><span lang="he" dir="rtl"><b>
			- </b></span><b><span dir="rtl">NV</span></b></font></p>
			<p align="center"><span dir="rtl">
			<font face="Times New Roman" color="#800080">Ω
			</font></span><span lang="he" dir="rtl">
			<a href="../../Results/editor/ASPsearch.asp">
			<font color="#800080">חיפוש לקוח קיים</font></a></span><font color="#800080"><span dir="rtl">
			<font face="Times New Roman">Ω</font> </span>
			</font>
			<a href="submission_form.asp"><span lang="he" dir="rtl">
			<font color="#800080">יצירת לקוח חדש</font></span></a><span dir="rtl"><font color="#800080">
			<font face="Times New Roman">Ω</font>
</font>
<a href="database_editor.asp"><span lang="he"><font color="#800080">ערוך לקוח קיים</font></span></a><font color="#800080">
			<font face="Times New Roman">Ω</font></font></span></p>

			</td>
		</tr>
		<tr>
			<td height="25" width="724"> </td>
		</tr>
	</table>
</div>

<%

Dim SqlJunk


Set dbGlobalWeb = Server.CreateObject("ADODB.Connection")
dbGlobalWeb.Open("nv")

SqlJunk = "SELECT * FROM results"

If Request.Form("TypeSearch") = "firstName" Then
	SqlJunk = SqlJunk & " WHERE firstName LIKE '%" & Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "lastName" Then	
	SqlJunk = SqlJunk & " WHERE lastName LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "address" Then
	SqlJunk = SqlJunk & " WHERE address LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "homePhone" Then
	SqlJunk = SqlJunk & " WHERE homePhone LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "mobilePhone" Then	
	SqlJunk = SqlJunk & " WHERE mobilePhone LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "dateOfBirthMonth" Then	
	SqlJunk = SqlJunk & " WHERE dateOfBirthMonth LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "oxygen" Then	
	SqlJunk = SqlJunk & " WHERE oxygen LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

If Request.Form("TypeSearch") = "notes" Then	
	SqlJunk = SqlJunk & " WHERE notes LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset")
rsGlobalWeb.Open SqlJunk, dbGlobalWeb, 3
%>
<%
If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then%>

<p> </p>

</span>

<h2 align="center"><span dir="rtl">לא נמצאו לקוחות לפי הקריטריונים שהכנסת...</span></h2>
<p align="center"> </p>
<span dir="rtl">
<%Else%>


<%If Not rsGlobalWeb.BOF Then%>

</span>

<table BORDER="0" width="100%" cellpadding="3">
  <tr>
    <th bgcolor="#C0C0C0"><span dir="rtl"><font face="Arial" color="#FFFFFF">
    קוד
    <th bgcolor="#C0C0C0"><span lang="he" dir="rtl">
	<font face="Arial" color="#FFFFFF">שם פרטי</font></span><span dir="rtl"><font face="Arial" color="#FFFFFF">
	</font></span></th>
    <th bgcolor="#C0C0C0"><span lang="he" dir="rtl">
	<font face="Arial" color="#FFFFFF">שם משפחה</font></span><span dir="rtl"><font face="Arial" color="#FFFFFF"> </font>
	</span></th>
    <th bgcolor="#C0C0C0"><span lang="he" dir="rtl">
	<font face="Arial" color="#FFFFFF">כתובת</font></span><span dir="rtl"><font face="Arial" color="#FFFFFF"> </font>
	</span></th>
    <th bgcolor="#C0C0C0"><span lang="he" dir="rtl">
	<font face="Arial" color="#FFFFFF">טלפון בבית</font></span><span dir="rtl"><font face="Arial" color="#FFFFFF"> </font>
	</span></th>
    <th bgcolor="#C0C0C0"><span dir="rtl"><font face="Arial" color="#FFFFFF">טלפון נייד</font></span></th>
	<th bgcolor="#C0C0C0"><span dir="rtl"><font face="Arial" color="#FFFFFF">חודש לידה</font></span><th bgcolor="#C0C0C0"><span dir="rtl">
	<span dir="rtl"><font face="Arial" color="#FFFFFF">יום לידה</font></span><th bgcolor="#C0C0C0">
	<span dir="rtl"><font face="Arial" color="#FFFFFF">סוג שיער</font></span><th bgcolor="#C0C0C0">
	<span dir="rtl"><font face="Arial" color="#FFFFFF">צבע שיער</font></span><th bgcolor="#C0C0C0">
	<span dir="rtl"><font face="Arial" color="#FFFFFF">אחוז חמצן</font></span><th bgcolor="#C0C0C0">
	<span dir="rtl"><font face="Arial" color="#FFFFFF">הערות</font></span><th bgcolor="#C0C0C0">
<%
	Do While Not rsGlobalWeb.EOF
	%>
  <tr>
	<td><span dir="rtl"><a href="detail.asp?Key=<%=rsGlobalWeb("key")%>"><%=rsGlobalWeb("key")%></a>
</span>
</td>
    <td><span dir="rtl"><%=rsGlobalWeb("firstName")%>
</span>
</td>
    <td><span dir="rtl"><%=rsGlobalWeb("lastName")%>
</span>
</td>
    <td><span dir="rtl"><%=rsGlobalWeb("address")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("homePhone")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("mobilePhone")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("dateOfBirthMonth")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("dateOfBirthDay")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("hairType")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("hairColour")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("oxygen")%>
</span>
</td>
<td><span dir="rtl"><%=rsGlobalWeb("notes")%>
</span>
</td>

<% rsGlobalWeb.MoveNext
	Loop
	%>
</table>
<span dir="rtl">
<%End If%>
<%End If%>
<%
rsGlobalWeb.Close
dbGlobalWeb.Close
%>
</span>
</body>
</html>




Spooky -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 15:41:25)

What is the resulting SQL?

If Request.Form("TypeSearch") = "notes" Then	
	SqlJunk = SqlJunk & " WHERE notes LIKE '%" & _
	    Request.Form("DaInBox") & "%'"
End If

response.write SqlJunk 
response.end

Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset")




Meni -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 16:22:29)

please elaborate spooky. what exactly do you mean?




Spooky -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 16:24:55)

See the changes to your code above? Add those 2 lines. Run the code through the browser. What is the result displayed on the screen?




Meni -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 19:15:07)

when i run a search with no parameters this is what I get after adding your code.

SELECT * FROM results WHERE firstName LIKE '%%'


If I search for a certain name, This is what I get after adding your code:

SELECT * FROM results WHERE firstName LIKE '%name%'




BeTheBall -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 19:19:21)

Do you perhaps have a link to the offending page?




Meni -> RE: Item cannot be found in the collection corresponding to the requested name or ordinal (8/3/2005 19:36:04)

PROBLEM SOLVED

The thing is, searching returns the proper values. In the page that returns the results, I have the "key" value hyperlinked so that when it's clicked - it will send the user to the detail.asp page. It's when I click on thet "key" link that I get the error.

turns out - there was no reference to the new DB columns.

I feel so stupid.

works now!

Thanks for all your help!












Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625