Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 05-04-2007, 12:21 PM asp array help
Junior Talker

Posts: 2
Trades: 0
I'm in need of some assistance with (classic) ASP. I've never used arrays and I'm not sure where to begin.

How can I do the following:

Take the contents of a SQL table and store each individual row as a seperate array item, and then display each individual item.

Any help would be greatly appreciated.
kingfire is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-04-2007, 01:59 PM Re: asp array help
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
RSObject.GetRows() http://www.devguru.com/technologies/ado/8678.asp

response.write arrayname(column,row)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-04-2007, 05:42 PM Re: asp array help
mb2000inc's Avatar
Super Talker

Posts: 140
Name: Mark
Location: Ohio
Trades: 0
What if you have a (javascript)combobox (in an ASP page) that you're trying to fill from an SQL server database? I have this code here, but I can't get it to work...

Function PrintJavascriptArray(ByRef objCN, strsql)
Dim objRS, ArrayRecords, i, j
Dim NumRows, NumColumns
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strsql,objcn,adOpenForwardOnly,adLockReadOnly,adCm dText
Do While Not objRS.EOF
ArrayRecords = objRS.GetRows(50)
NumRows = UBound(ArrayRecords,2)
NumColumns = UBound(ArrayRecords,1)
For i = 0 To NumRows
For j = 0 To NumColumns
Response.write Chr(34)
If Not IsNull(ArrayRecords(j, i)) Then
Response.write Replace(ArrayRecords(j, i), _
Chr(34),Chr(34)&"+String.fromCharCode(34)+"&Chr(34 ))
End If
Response.write Chr(34)
' Print comma, except at last record
If Not objRS.EOF Or i <> NumRows _
Or j <> NumColumns Then
Response.write ","
End If
Next
Next
Response.write vbCrLf
Loop
objRS.Close
Set objRS = nothing
End Function

Then I'm calling it with this:

<script type="text/javascript">
myJavascriptArray = Array(
<% PrintJavascriptArray "DSN=MyDSN", _
"SELECT ObjectID, ObjectName FROM tblObjects" %>
);
</script>
__________________
Need a vacation.
mb2000inc is offline
Reply With Quote
View Public Profile Visit mb2000inc's homepage!
 
Reply     « Reply to asp array help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17849 seconds with 12 queries