Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Getrows causing me a headache

    The below code works fine until i call the BuildLinksArray sub routine. I'm getting the wonderful "Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record." error but i've tested my query and it runs fine when i replace the Array variable with an actual number. I also checked and the subRoutine is passing an ID for each of the arrGlossary ?


    Code:
    <!--#include file="../Connections/adovbs.inc" -->
    <%
    	iRecordId=Request.Querystring("id")
    	
    	If IsNumeric(iRecordId) Then
    		iRecordId = CLng(iRecordId)
    	Else
    		iRecordId = 0
    	End If
    	
    	Dim SCRIPT_NAME
    	SCRIPT_NAME = Request.ServerVariables("SCRIPT_NAME")	
    	
    	Response.write("<A href='"&SCRIPT_NAME&"' class='MoreArmyNewsHeadline'>Display All</A>")	
    	response.write ("&nbsp;<img src=../Images/divider.gif>")
    	response.write ("<p></p>")
    	
    	'<---------------------  Get the Glossary Definitions ------------------------->
    	'Get the Glossary Definitions and store them in an array
    	set conn=Server.CreateObject("ADODB.Connection")
    	conn.Provider="Microsoft.Jet.OLEDB.4.0"
    	conn.Open Server.MapPath("../Access/Glossary.mdb")
    	
    	strSQL="SELECT tblGlossary.GlossaryId, tblTerms.Term_e, tblDesc.Desc_e "
    	strSQL=strSQL & " FROM (tblGlossary INNER JOIN tblTerms ON tblGlossary.TermsId = tblTerms.TermsID)"	
    	strSQL=strSQL & " INNER JOIN tblDesc ON tblGlossary.DescId = tblDesc.DescID"	
    
    
    	IF iRecordId<>"0" THEN
    		strSQL =strSQL & " WHERE tblGlossary.DescID=" & iRecordId
    	END IF
    	
    	'response.Write(strSQL)
    	'response.end
    	
    	Set cnnGetRows = Server.CreateObject("ADODB.Connection")
    	cnnGetRows.Open conn
    
    	Set rstGetRows = cnnGetRows.Execute(strSQL)
    	arrGlossary = rstGetRows.GetRows(, adBookmarkCurrent, Array("GlossaryId","Term_e","Desc_e"))
    	
    	rstGetRows.Close
    	Set rstGetRows = Nothing
    	cnnGetRows.Close
    	Set cnnGetRows = Nothing
    	'<--------------------- END Get the Glossary Definitions ------------------------->
    	
    	
    	
    	'<------- Loop through all the Definitions ----------------------->		
    	' IF a Defintion is Found as text in the Article Variable, use the Highlight Function to Add A HREF code to it --->
    	For I = LBound(arrGlossary, 2) To UBound(arrGlossary, 2)
    
    		Response.write ("<table width='450' border='0' cellpadding='0' cellspacing='0'>"& vbCrLf)
    		Response.write ("<tr>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_topleft.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("<td width='300' align='left' valign='top' background='../Images/2_0/equip_lines_Top.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("<td width='120' align='left' valign='top' background='../Images/2_0/equip_lines_Top.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("<td width='15' background='../Images/2_0/equip_lines_topright.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("</tr>"& vbCrLf)
    
    		Response.write ("<tr>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_left.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("<td align='left' vAlign='top' ColSpan='2'><A Class='SubHeadline'>"&arrGlossary(1,I)&"</A></BR></td>"& vbCrLf)
    		'Response.write ("<td align='left' valign='top'><div align='center'>gggg</div></td>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_right.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("</tr>"& vbCrLf)
    		
    		Response.write ("<tr>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_left.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("<td align='left' vAlign='top' ColSpan='2'></BR>"&arrGlossary(2,I)&"</td>"& vbCrLf)
    		'Response.write ("<td align='left' valign='top'><div align='center'>gggg</div></td>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_right.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("</tr>"& vbCrLf)
    		
    '		'Check and see if there are Related Links ---->
    		Call BuildLinksArray (arrGlossary(0,I))
    '		'END Check and see if there are Related Links ---->		
    		
    		Response.write ("<tr>"& vbCrLf)
    		Response.write ("<td width='12' height='25' background='../Images/2_0/equip_lines_bottomLeft.jpg'>&nbsp;</td>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_Bottom.jpg'></td>"& vbCrLf)
    		Response.write ("<td background='../Images/2_0/equip_lines_Bottom.jpg'><div align='center'>&nbsp;</Div></td>"& vbCrLf)
    		Response.write ("<td nowrap='nowrap' background='../Images/2_0/equip_lines_bottomRight.jpg'></td>"& vbCrLf)
    		Response.write ("</tr>"& vbCrLf)
    		Response.write ("</table>"& vbCrLf)
    		Response.write ("<p></p>"& vbCrLf)
    
    	Next 	'I
    	'<------- END Loop through all the Definitions ----------------------->					
    
    
    Sub BuildLinksArray (theID)
    
    	'<---------------------  CHECK FOR LINKS ------------------------->
    		'Uses the Id of the current Glossary term and check for matching Links
    		set conn=Server.CreateObject("ADODB.Connection")
    		conn.Provider="Microsoft.Jet.OLEDB.4.0"
    		conn.Open Server.MapPath("../Access/Glossary.mdb")
    		
    		sSQL="SELECT tblLinks.GlossaryId, tblLinks.Link_e, tblLinks.Desc_e  "
    		sSQL=sSQL & " FROM tblLinks"	
    		sSQL=sSQL & " WHERE (((tblLinks.GlossaryId)="&theID&"))"	
    
    
    		Set cnnGetRows = Server.CreateObject("ADODB.Connection")
    		cnnGetRows.Open conn
    	
    		Set rstGetRows = cnnGetRows.Execute(sSQL)
    		arrLinks = rstGetRows.GetRows(, , Array("GlossaryId","Link_e","Desc_e"))
    		
    		rstGetRows.Close
    		Set rstGetRows = Nothing
    		cnnGetRows.Close
    		Set cnnGetRows = Nothing
    			
    		IF IsArray(arrLinks)THEN
    	
    			Response.write ("<tr>"& vbCrLf)
    			Response.write ("<td width='15' background='../Images/2_0/equip_lines_left.jpg'></td>"& vbCrLf)
    			Response.write ("<td colspan='4'  valign='top'>"&vbCrLf)
    			Response.write ("</BR>")
    				For Y = LBound(arrLinks, 2) To UBound(arrLinks, 2)			
    					Response.write ("<A href='"&arrLinks(0,Y)&"' target='new'>"&arrLinks(1,Y)&"</A></BR>")
    				Next 'Y
    			Response.write ("</td>"& vbCrLf)
    			Response.write ("<td width='15' background='../Images/2_0/equip_lines_right.jpg'>&nbsp;</td>"& vbCrLf)
    			Response.write ("</tr>"& vbCrLf)	
    		Else
    			'Exit Sub		
    		END IF	
    				
    		'Erase arrLinks 'Clear the Array so that the contents don;t reappear in another RS
    	
    		'<---------------------  END CHECK FOR LINKS ------------------------->	
    End Sub	
    %>

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    I'm confused:

    Code:
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open Server.MapPath("../Access/Glossary.mdb")
    Code:
    Set cnnGetRows = Server.CreateObject("ADODB.Connection")
    cnnGetRows.Open conn
    I'm pretty sure that the ADODB.Connection object won't take an existing - and especially open - connection object as an Open() argument. You should just be able to reuse the connection:

    Code:
    Set rstGetRows = conn.Execute(strSQL)
    Other than that... not sure. have you tried response.write() the uBounds of your array? If it's not getting populated right, that'll tell you.

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quite right, did a little cleanup and it's all good now.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •