473,651 Members | 3,090 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 3470
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
2152
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. Write now, i have emails that i receive in outlook and i want to transfer them into a database. I realized that i could export this. however, the BODY section of the email is exported as one field. As the email i receive is a template and it is...
2
1774
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 HolidaysListBox.SelectedValue to get mult selected values, but it looks not work for me, anyone has an idea for this? Thanks
3
2151
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 are storing the same type of information in multiple cells. For example, for each machine in the shop, there is a code for why the machine was down--A1, B1, C1...for example. The spreadsheet is set up like this: ...
6
1579
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 something like rsA.Fields.Item("A").Value + rsB.Fields.Item("B").Value didnt work because one of the fields was a empty value. I have about 6 fields i need to add together if a value exists in any of them.
0
1423
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 FormView1.ChangeMode(FormViewMode.Insert); // Repopulate the form Label.Text = "12345"; TextBox.Text = "22";
4
5681
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
1578
by: adamjblakey | last post by:
Hi, I have a function here: var AdminResponse = ""; function parseResponse(){ var nText = AdminResponse.getElementsByTagName('optionText');
4
3805
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
2706
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
8278
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8807
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8701
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7299
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4144
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
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 we have to send another system
1
1912
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.