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 > build array from database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-01-03, 15:01
rob7765 rob7765 is offline
Registered User
 
Join Date: Oct 2002
Location: Houston, TX
Posts: 34
build array from database

I need to insert two values from a table in a database into an array. I know nothing about arrays!

I am using a script that builds a chart that uses an array which is why I need this.

The Array in the Chart script looks like this:
ShowChart Array(835, 636, 809, 724), Array("7/12/2003", "7/26/2003", "7/29/2003", "8/1/2003"), "Photo Totals", "Locations", "Photos"

I added the numbers and dates as an example of the data being pulled from the database. Basically I am pulling the number of photos taken per date.

I can select the data using this script below but I don't know how to add the values to the Array.

Set RS1 = conn.Execute("SELECT DISTINCT photo_date FROM tbl_photos WHERE tbl_photos.event_id = '"&event_id&"' ")

Do While Not RS1.EOF

photo_date = RS1("photo_date")

sql_1 = "SELECT COUNT(Code2) AS total_photos_taken FROM(SELECT event_id, code2 FROM tbl_photos WHERE event_id = '"&event_id&"' and photo_date = '"&photo_date&"') DERIVEDTBL"

Set RS = Conn.Execute(sql_1)
total_photos_taken = RS(0)


RS1.MoveNext
Loop

Can someone help me add the values to the Array?
Reply With Quote
  #2 (permalink)  
Old 08-04-03, 02:29
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Here's an excerpt of filling an array from a sample page regarding my own barchart (www.bullschmidt.com/barchart.asp):

Dim aChartData(2, 3) ' Max fld num - 1, max row num minus 1, note arrays start at 0.

' Fill aChartData.
' (Row 1.)
aChartData(0, 0) = 5123.23
aChartData(1, 0) = 3906.54
aChartData(2, 0) = 3578.97
' (Row 2.)
aChartData(0, 1) = 5582.23
aChartData(1, 1) = 4679.10
aChartData(2, 1) = 3035.00
' (Row 3.)
aChartData(0, 2) = 7027.02
aChartData(1, 2) = 5756.55
aChartData(2, 2) = 3921.45
' (Row 4.)
aChartData(0, 3) = 6652.78
aChartData(1, 3) = 6756.43
aChartData(2, 3) = 4034.76
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
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