473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP - how to select values from different fields and loop through them?

10 New Member
I have a table with many different fields in, including 40 separate image fields. ("Pic1" "Pic2" "Pic3" etc...)
each field has a single value (an image name) in, I need to be able to select all these fields as a single record and loop through them.

Something like
Expand|Select|Wrap|Line Numbers
  1. Select Pic1, Pic2, Pic3, Pic4, etc... From Gallery Where GalleryID = 123
Each gallery has a unique id in the table and has several different fields including a couple of text fields, and 40 different image fields.

Not every gallery will have 40 actual images in, so im looking to select all the image fields that actually have data for that gallery, and then to be able to count the number of images and loop through displaying them on the page.

Im not very good at programming, just a tiny little bit of self taught basic asp. So any help would be really appreciated.
Apr 17 '13 #1
3 3464
DesignsOnline
10 New Member
Im not sure I explained myself very clearly above.

After selecting the fields that I require from the table,
I want to be able to group them somehow as if they were all selected from a single field, and then count them, and loop through displaying them on the page one after the other.

I know how to select the fields I need, but it is the grouping, counting and looping through part I need guidance with.

Is that better explained?
Apr 17 '13 #2
DesignsOnline
10 New Member
I dont know if I should be using Array?
I could select all the fields I need then do something like:

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Select Pic1, Pic2, Pic3, Pic4, Pic5, Pic6, Pic7, Pic8, Pic9, Pic10 From Gallery Where GalleryID = 123
  3. %>
  4.  
  5.  
  6. <%
  7. Dim GalleryArray() 'Dynamic array
  8. GalleryArray(0) = "rsGallery.Item("Pic1").value"
  9. GalleryArray(1) = "rsGallery.Item("Pic2").value"
  10. GalleryArray(2) = "rsGallery.Item("Pic3").value"
  11. GalleryArray(3) = "rsGallery.Item("Pic4").value"
  12. GalleryArray(4) = "rsGallery.Item("Pic5").value"
  13. GalleryArray(5) = "rsGallery.Item("Pic6").value"
  14. GalleryArray(6) = "rsGallery.Item("Pic7").value"
  15. GalleryArray(7) = "rsGallery.Item("Pic8").value""
  16. GalleryArray(8) = "rsGallery.Item("Pic9").value"
  17. GalleryArray(9) = "rsGallery.Item("Pic10").value"
  18. For Each item In GalleryArray
  19.     Response.Write(item & "<br />")
  20. Next
  21. %>
  22.  
But that wouldnt count the number of images and I dont even know if it would display each image separately and allow me to control the layout?
Apr 17 '13 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Is this the same question as your other thread?
Apr 17 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2150
by: Branden | last post by:
hi guys, i was wondering if it is possible to extract selected words in a field to be put in different fields automatically. Do i have to write the code in vb? This is what im trying to do....
2
1765
by: Tony Dong | last post by:
HI there I make a data binding for list box, and it is multi selects, everything working fine, but How can I get the multi select values in windows form? I try many ways for...
3
2142
by: shaqattack1992-newsgroups | last post by:
Hello Everyone, At work, employees have been using a spreadsheet that I am trying to import into an access database to make some reports. The problem I'm having is that in the spreadsheet, they...
6
1576
by: Mangler | last post by:
Say I have to different recordsets that have the fields: rsA.Fields.Item("A").Value ,rsB.Fields.Item("B").Value How would I add those to fields? It may be my inexperience but when I tried...
0
1416
by: R Bandeira | last post by:
How to keep values in fields after ChangeMode to Insert from Edit? I am implementing a re-insert type feature, after an edit. // Change form to insert mode...
4
5671
by: ataurrehman | last post by:
I want to use select case in a loop as under: Dim i As Integer i = 1 While i < 6 Select Case Field1 Case "Title" strFld(i) = "( & ': ' & )" Case "Author" strFld(i) = "( & ', ' &...
14
1570
by: adamjblakey | last post by:
Hi, I have a function here: var AdminResponse = ""; function parseResponse(){ var nText = AdminResponse.getElementsByTagName('optionText');
4
3794
by: perhapscwk | last post by:
Sample tables (company_id RK companies.id): Companies id company 1 … 2 … 3 … Locations id company_id location revision
10
2675
by: Raven7738 | last post by:
Hey, I'm using Access 2007. I have a code to open a new message in outlook 2007. Private Sub btnEmail_Click() Dim ol As Outlook.Application Dim inbox As Folder Dim msg As MailItem
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.