a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

increment varible name in database query

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> increment varible name in database query
Page: [1]
 
ACEDISH

 

Posts: 176
Joined: 9/30/2002
From: Manassas, Virginia
Status: offline

 
increment varible name in database query - 11/21/2006 16:33:32   
Hello,
I want to increment the varible name by 1 when looping through Record Setsbut I am having some difficulty. I tried the following with no luck.

Do until RS1.EOF
c=c+1
pic(c)&1=RS1("filename")
picdesc(c)=RS1("picdesc")
picdate(c)=RS1("uploaddate")


END IF
RS1.MoveNext


_____________________________

" Anyone who can only think of one way to spell a word obviously lacks imagination"
Spooky

 

Posts: 26617
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: increment varible name in database query - 11/21/2006 19:08:08   
Explain why you are trying to achieve that?
If anything I would suggest using getrows and have the result available to you in an array by default

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to ACEDISH)
ACEDISH

 

Posts: 176
Joined: 9/30/2002
From: Manassas, Virginia
Status: offline

 
RE: increment varible name in database query - 11/21/2006 19:59:42   
This isn't pretty but it is working, basically I am displaying the last 4 thumbnails in a photo page. the pictures are in various locations in the page so I was defining which pictures and details that would be displayed.



Set DB1 = Server.CreateObject("ADODB.Connection")
DB1.Open Application("membersDB_ConnectionString")
Set RS1 = DB1.Execute ("SELECT * FROM pic WHERE (siteID = '1' AND ID > '"& startID & "') ORDER BY ID DESC")
Do until RS1.EOF
c=c+1
IF c = 1 THEN
pic1 =RS1("filename")
picdesc1=left(RS1("picdesc"),80)
picdate1=RS1("uploaddate")
END IF
IF c = 2 THEN
pic2 =RS1("filename")
picdesc2=left(RS1("picdesc"),80)
picdate2=RS1("uploaddate")
END IF
IF c = 3 THEN
pic3 =RS1("filename")
picdesc3=left(RS1("picdesc"),80)
picdate3=RS1("uploaddate")
END IF
IF c = 4 THEN
pic4 =RS1("filename")
picdesc4=left(RS1("picdesc"),80)
picdate4=RS1("uploaddate")
END IF



RS1.MoveNext
Loop




_____________________________

" Anyone who can only think of one way to spell a word obviously lacks imagination"

(in reply to Spooky)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> increment varible name in database query
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts