If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Complex Fields index

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-27-07, 05:49
noamsmadja noamsmadja is offline
Registered User
 
Join Date: Dec 2007
Posts: 21
Question [SOLVED]Complex Fields index

i'll just put the Code first, and ask my question later.

Code:
Dim AuthID 
AuthID = Topic.Fields.Item("Autnm").Value
.
.
.
<%=(Author_Names_From_ID.Fields(AuthID).Item("Author_Hebrew").Value)%>
Autnm is numbers, 1-20.
AuthID is suposed to take this number.
Than it should print from Author_Hebrew in field AuthID

but it says:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.


Seems it points wrong on the field... any idea?

if u need the whole code its just 100 lines... well i'll post it here any ways:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="28598"%>
<!--#include file="Connections/KerenDB.asp" -->
<%
Dim Topic__MMColParam
Topic__MMColParam = "1"
If (Request.QueryString("Topic") <> "") Then 
  Topic__MMColParam = Request.QueryString("Topic")
End If
%>
<%
Dim Topic
Dim Topic_numRows

Set Topic = Server.CreateObject("ADODB.Recordset")
Topic.ActiveConnection = MM_KerenDB_STRING
Topic.Source = "SELECT Bknm_Hebrew, Bknm_English, Autnm, Note, ISBN, Pages, Size, Cover, Topic, PUSD, PNIS, PEUR, PLS, Lang FROM Library,Author WHERE Topic = '" + Replace(Topic__MMColParam, "'", "''") + "' ORDER BY Bknm_Hebrew ASC"
Topic.CursorType = 0
Topic.CursorLocation = 2
Topic.LockType = 1
Topic.Open()

Topic_numRows = 0
%>
<%
Dim Autnm_hebrew
Dim Autnm_English
Autnm_ID = Topic.Fields.Item("Autnm").Value
%>
<%
Dim Author_Names_From_ID
Dim Author_Names_From_ID_numRows

Set Author_Names_From_ID = Server.CreateObject("ADODB.Recordset")
Author_Names_From_ID.ActiveConnection = MM_KerenDB_STRING
Author_Names_From_ID.Source = "SELECT ID, Author_English, Author_hebrew FROM Author ORDER BY ID ASC"
Author_Names_From_ID.CursorType = 0
Author_Names_From_ID.CursorLocation = 2
Author_Names_From_ID.LockType = 1
Author_Names_From_ID.Open()

Author_Names_From_ID_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 10
Repeat1__index = 0
Topic_numRows = Topic_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Dim Repeat2__index

Repeat2__numRows = -1
Repeat2__index = 0
Topic_numRows = Topic_numRows + Repeat2__numRows
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;" />
<title>Keren Ahvah Meshihit</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="1" cellpadding="1" cellspacing="1">
  <% While ((Repeat1__numRows <> 0) AND (NOT Topic.EOF)) %>
    <%
	Dim AuthID 
	AuthID = Topic.Fields.Item("Autnm").Value
	%>
	<tr>
      <td rowspan="3">image</td>
      <td colspan="3"><h3>
        <%=(Topic.Fields.Item("Bknm_Hebrew").Value)%><br />
      <%=(Author_Names_From_ID.Fields(AuthID).Item("Author_Hebrew").Value)%></td>
    </tr>
    <tr>
      <td colspan="3"><h4>
        <%=(Topic.Fields.Item("Bknm_English").Value)%><br />
        <%=AuthID%>
		<%=(Author_Names_From_ID.Fields(AuthID).Item("Author_English").Value)%></td>

    </tr>
    <tr>
      <td colspan="3"><h5>
        <%=(Topic.Fields.Item("Note").Value)%></td>
    </tr>
    <tr>
      <td><h6>
        <%=(Topic.Fields.Item("Topic").Value)%></td>
      <td><h6>
        <%=(Topic.Fields.Item("Pages").Value)%></td>
      <td><h6>
        <%=(Topic.Fields.Item("ISBN").Value)%></td>
      <td><h6>
        <%=(Topic.Fields.Item("PUSD").Value)%></td>
    </tr>
    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Topic.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
Topic.Close()
Set Topic = Nothing
%>
<%
Author_Names_From_ID.Close()
Set Author_Names_From_ID = Nothing
%>

Last edited by noamsmadja; 12-27-07 at 08:41. Reason: Problem solved
Reply With Quote
  #2 (permalink)  
Old 12-27-07, 08:40
noamsmadja noamsmadja is offline
Registered User
 
Join Date: Dec 2007
Posts: 21
Problem Solved

I managed to do it else ways

Thanks anyways!!
Reply With Quote
  #3 (permalink)  
Old 12-27-07, 18:32
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Well done... What was the solution?
__________________
George
Twitter | Blog
Reply With Quote
  #4 (permalink)  
Old 12-27-07, 18:43
noamsmadja noamsmadja is offline
Registered User
 
Join Date: Dec 2007
Posts: 21
Relationship mistake

i did a wrongrelationship, relating text to number types. After fixing it in the db it worked. Eventualy ot is to complex to relate a text field... Am i right? Could someone enlighten us plz.
Thx in advance!!!
Reply With Quote
  #5 (permalink)  
Old 01-04-08, 09:17
Marvels Marvels is offline
Registered User
 
Join Date: Jul 2003
Location: Amsterdam, Nederland
Posts: 449
re

Quote:
Originally Posted by noamsmadja
i did a wrongrelationship, relating text to number types. After fixing it in the db it worked. Eventualy ot is to complex to relate a text field... Am i right? Could someone enlighten us plz.
Thx in advance!!!
Youll have to do a cast of the type if your wanna make a link from Text to number

with numbers you do a JOIN and it compares 1 with 1
with text you do a JOIN and it compares "ABC" with "ABC"

if you want text to compare with numbers you cant do
JOIN to compare "ABC" with 1 (gives a type mismatch)
with a cast you can fool it to do a JOIN on "ABC" with "1"
Reply With Quote
  #6 (permalink)  
Old 01-04-08, 09:53
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I suggest you just make them the same datatype (and size/limit) instead of casting/converting on your joins!
__________________
George
Twitter | Blog
Reply With Quote
  #7 (permalink)  
Old 01-14-08, 06:51
noamsmadja noamsmadja is offline
Registered User
 
Join Date: Dec 2007
Posts: 21
its solved already... no more posts... thx!!
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On