-
Loading Array from Dataset
I'm tyring to load an array from a dataset. There are 10 records in the dataset. What I'm doing is setting a datarow and looping through this dataset and trying to add each row to an array. Not sure how to do this?
Also, If I wanted to skip the array all together, when I loop through the dataset how do I add each row individually to another dataset?
thanks for the help
jb
-
It all depends on what format your data set is in. If your dataset is going to be varying in elements, all you have to do is:
Code:
dim myArr()
y=0
For Each item In DataSet
ReDim Preserve myArr(y)
myArr(y) = item
y=y+1
Next
-
My dataset has 3 fields in it, all are strings, 10 records total. I would like each element in the array to be a row from the dataset. Is this possible?
-
but where is your data stored??? are we talking database, flat file, etc. if it's a database, dumping the information into the array will depend on your query. if it's a flat file, it will depend on how the information is presented on each line.
-
Sorry.. It's coming from a sql server database. I have the array loaded with the data, when I do a datagridview.datasource = arrayname it just puts the lenght of each element in the first column.
-
can you post the snippet of code dealing with the problem pls.
-
Thanks for the help. I figured out. I had to create my columns programmatically then create my array then add it to the grid. Sorry for the frustration..
Similar Threads
-
Replies: 1
Last Post: 10-17-2006, 02:42 PM
-
Replies: 1
Last Post: 01-12-2006, 07:53 PM
-
By Michael Koehmstedt in forum XML
Replies: 1
Last Post: 11-07-2002, 09:05 PM
-
Replies: 1
Last Post: 03-03-2002, 11:03 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|