Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Loop

Reply
 
 
Øyvind Isaksen
Guest
Posts: n/a
 
      03-15-2005
Hello!

I store from 1 to 50 (depending on input from user) image names in session
variables (not array), and put them in variables like this:

For X = 1 To 50
Execute("varImage_" & X & " = Session(""image_" & X & """)")
Next`

This work perfect, output is like this:
varImage_1 = session("image_1")
varImage_2 = session("image_2")
varImage_3 = session("image_3") and so on...



---Here is what I try to do:--------------

Now I'm stucked with almost the same "problem"... I need to create ut to 50
SQL's in a loop like the other code.
This code under will explain what I try to do, X shall go from 1 to 50. I
just need to get this correct:

For X = 1 To 50

if varImage_X <> "" then SQL_X = "insert into tblImage (path,sort,artID)
values ('"&varImage_X&"','X','"&dbArtID&"'); "

'Make variable SQL_SaveImgs with all the SQL's:
if varImage_X <> "" then SQL_SaveImgs = SQL_SaveImgs & SQL_X

Next

How can I do this so it works??

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


Try to get this output:
if varImage_1 <> "" then SQL_X = "insert into tblImage (path,sort,artID)
values ('"&varImage_1&"','1','"&dbArtID&"'); "
if varImage_2 <> "" then SQL_X = "insert into tblImage (path,sort,artID)
values ('"&varImage_2&"','2','"&dbArtID&"'); "
if varImage_3 <> "" then SQL_X = "insert into tblImage (path,sort,artID)
values ('"&varImage_3&"','3','"&dbArtID&"'); " and so on....

if varImage_1 <> "" then SQL_SaveImgs = SQL_SaveImgs & SQL_1
if varImage_2 <> "" then SQL_SaveImgs = SQL_SaveImgs & SQL_2
if varImage_3 <> "" then SQL_SaveImgs = SQL_SaveImgs & SQL_3 and so on....

(Will later on use SQL_SaveImgs to save all images)

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



Hope someone please can help me!!
Regards,
Mr Isaksen


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Getting a loop to activate a loop above it Byte Python 4 03-24-2006 03:04 AM
Condition outside loop or separate loop for different condition? - Java 12 06-15-2005 08:50 AM
while loop in a while loop Steven Java 5 03-30-2005 09:19 PM
Loop the loop... =?Utf-8?B?VGltOjouLg==?= ASP .Net 2 02-16-2005 12:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57