Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-20-2002, 09:31 AM   PM User | #1
pthompson2002
New Coder

 
Join Date: Aug 2002
Location: Ipswich
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
pthompson2002 is an unknown quantity at this point
Populating a 2-D array from a database

Hello all, me again.

I have realised I need a 2-D instead of the 1-D array (below) for ther est of task to work.
My question is how can I change the code below to make it a 2-D array.

------------------------------

<script language = "JavaScript">
<!-- //Begin Hide
//Create the Array

var messages=new Array(<%=rsCount("MaxCount")%>);

//Populate the Array
<%
i = 0
do while NOT rsBroadcast.EOF
%>
messages[<%=i%>]="<font color=orange><%=rsBroadcast("Title")%></font>"
<%
i = i + 1
rsBroadcast.MoveNext
Loop
%>
// End Hide -->
</script>

-------------------------------------

the other 'column' in the array is going to be the "message" column from the same table as the title of that helps.

cheers

Pete

PS. this forum is fantastic for responses, I can't believe how everyone responds so quickly!
pthompson2002 is offline   Reply With Quote
Old 08-20-2002, 11:51 AM   PM User | #2
raf
Master Coder


 
Join Date: Jul 2002
Posts: 6,589
Thanks: 0
Thanked 0 Times in 0 Posts
raf will become famous soon enoughraf will become famous soon enough
maybe a stupid question, buth why are you trying to populate an array with data from a recordset (which is itself an array)

in your title, i read populating ... from a database so i assume you could use a select-query to generate a recordset that contains those two variables ? no ?
raf is offline   Reply With Quote
Old 08-20-2002, 01:06 PM   PM User | #3
allida77
Regular Coder

 
Join Date: Jun 2002
Location: Cincinnati, OH
Posts: 545
Thanks: 0
Thanked 0 Times in 0 Posts
allida77 is an unknown quantity at this point
Use the .GetRows() method . It will automatically put your rs into a 2d array.
allida77 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 10:58 PM.


Advertisement
Log in to turn off these ads.