Link to home
Start Free TrialLog in
Avatar of WebGirlCrissy
WebGirlCrissyFlag for United States of America

asked on

asp array - set up dynamic link from database

Hi there -- I have a database SQL query that outputs two fields, LINK & ACQUIROR:

LINK                            ACQUIROR
http://lLinkTest.com      Krebs Architecture & Engineering
http://anotherLink.com        Abc company
http://testing.com                Def Comapny

and I want to create an array that sets the company name with the link. My code below is just pulling the Acquiror right now. I've tried to link up the array but getting errors... any insights?
<%  'AL ACQUIROR
strSQL = "SELECT [2009Data].Acquiror, [2009Data].LINK FROM 2009Data WHERE ((([2009Data].AcquirorState)='AL'));"
 
    Set objRS = Server.CreateObject ("ADODB.Recordset")
   	objRS.Open strSQL, ODBC_CNCT
		If Not objRS.EOF Then
	MyArray = objrs.GetRows()
	
Ubound MyArray,1 'Returns the Number of Columns
Ubound MyArray,2 'Returns the Number of Rows
 
Dim varALPopupTextA
For i = 0 to uBound(MyArray,2)
		
	varALPopupTextA = varALPopupTextA & "- " &  MyArray(0,i) 
		
Next
Else
	varALPopupTextA = "- (0)<BR>"
End If
objrs.Close()
	Set objrs = Nothing

Open in new window

Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

are you wanting something like this?
This is not using an Array, but it is simple and clean
Carrzkiss
<%
Set objRs=CreateObject("ADODB.RecordSet")
getSQL = "SELECT Acquiror, Link FROM 2009Data WHERE ((([2009Data].AcquirorState)='AL'));"
objRs.Open getSQL, objConn, 1, 1, 1
%>
                
<table>
  <tr>
    <td>Link</td>
    <td>Acquiror</td>
  </tr>
   <%While Not objRs.EOF%>
   <%Link=objRS("Link")
     Acquiror=objRS("Acquiror")
   %>
  <tr>
 
    <td><a href="<%=Link%>"><%=Link%></a></td>
    <td><%=Acquiror%></td>
  </tr>
  
  <%
    objRs.MoveNext
    Wend
    objRs.Close
    Set objRs=Nothing
%>
</table>

Open in new window

Avatar of WebGirlCrissy

ASKER

I was putting in array to take the load off access as i'm creating multiple recordsets and access doesnt allow multiple recordsets.  I doing this for 50 states and placing the outputs of all 50 states into variables to be called individually within my js.... If that makes it a bit clearer.  That's why i'm needing this into an array....
Yes access does, who ever told you that lied.

I ran over 100 rs on my access database before I had to change over to SQL Server.
I develop all my sites in Access with opening multiple recordsets.
I have a site that is LIVE right now, that opens 7 recordsets as soon as you load the page.

Anyway.
Do not let no-one tell you that Access cannot do certain things.
The limits of Access of a lot of people accessing it at 1 time with crash access.
Plus a few others bad things, but not the RecordSet.

Carrzkiss
as for the 50 states.
Are you going to load all this one 1 single page? (or) on 50 different Dynamic Pages?
If so, then the way that I supplied will work for you.

I will provide you a working demo of what I am talking about.
Give me about 30 minutes to make it up.
Here you go

Demo
http://ee.cffcs.com/Q_24698429/Q_24698429.asp
Code
http://ee.cffcs.com/Q_24698429/Q_24698429.zip

Demo includes database as well.
With a Table of all the States.

Hope this is what you are after, as this is the Fastest and easiest way to do it.
Carrzkiss
Thank you for your sample, however,  I'm not using tables i'm using image map of the 50 states and using js popups on rollover/popup with this dynamic data per state.  I have it working pulling both link and co. name(acquiror)  via arrays now but having trouble placing output variable to read like this:  "a href="http://companylinkfromdbArray1">CompanyNameArray2</a>"
 Let me know if you have any insight on that.
Thanks!
Crissy
Sorry.
Cannot assist with that issue.

Good Luck
Carrzkiss
ok thank you anyway :)
ASKER CERTIFIED SOLUTION
Avatar of WebGirlCrissy
WebGirlCrissy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome WebGirlCrissy (Love the name)
Accept yourself as Solution on this one. http:#a25368515

Keep up the great work!!!!
Carrzkiss
Thanks Carrzkiss!
:)
always welcome to the ladies of EE.

Carrzkiss