adoliv
asked on
Storing Data from a Column in a Variable
Hi Experts
Okay I am creating a ZIP File containing multiple images files, but the filepaths that I require are results from a SQL Query that populate a Gridview.
Process Flow: User Provides A Start Date And End Date > Button 1 Click > SQL Query > Populate Gridview With Results > If User is happy with results > 2nd Button Click > Download ZIP File.
I need to know how I can store all the data in numerous records in one column of the Gridview into a String Variable(Please supply the example code required because I have searched the net for examples for a while and come out with nothing)
Example
Id FileName Extension
1 image1 jpg
2 image2 gif
3 image3 jpg
Basically I want to be able to store all the values under the FileName column in a String Variable called "items" (Please view attached Code Snippet or Attached File).
Line 3 = New String() {"", "c:\test\Copy of one.txt", "c:\test\one.txt", "c:\test\o-fone.txt"}
I think is needs to look like this
New String() {"", + items}
code.txt
Okay I am creating a ZIP File containing multiple images files, but the filepaths that I require are results from a SQL Query that populate a Gridview.
Process Flow: User Provides A Start Date And End Date > Button 1 Click > SQL Query > Populate Gridview With Results > If User is happy with results > 2nd Button Click > Download ZIP File.
I need to know how I can store all the data in numerous records in one column of the Gridview into a String Variable(Please supply the example code required because I have searched the net for examples for a while and come out with nothing)
Example
Id FileName Extension
1 image1 jpg
2 image2 gif
3 image3 jpg
Basically I want to be able to store all the values under the FileName column in a String Variable called "items" (Please view attached Code Snippet or Attached File).
Line 3 = New String() {"", "c:\test\Copy of one.txt", "c:\test\one.txt", "c:\test\o-fone.txt"}
I think is needs to look like this
New String() {"", + items}
code.txt
ASKER
Cant I just Loop through the Gridview? Rather than having to create a seperate Dataset, populating the dataset and looping through that? It would be easier because I have already setup the query to place the received results within a Gridview.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Here is some examples of how to play with data:
http://bytes.com/groups/net-c/251798-loop-through-dataset-get-values-vb-net
http://msmvps.com/blogs/simpleman/archive/2005/06/24/54832.aspx
http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.adonet/topic4071.aspx
http://forums.asp.net/p/1059398/1516788.aspx