473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

how to fill a dataset using something OTHER than a SQL query?

I have this:

Dim aFiles as FileInfo() = dirInfo.GetFiles("*.*")

Does this create an array?

I'd like to walk through each item and then render out some text. My initial
thought was to attach the data to a dataset, walk through it, and then grab
the info as needed.

I haven't done much with arrays, though, and I can't seem to find an example
of filling a dataset with anything other than an XML file or DB query.

-Darrel
Nov 19 '05 #1
5 3354
JV
Darrel,

You can bind controls directly to the array that is returned by GetFiles(),
it is not required to convert it to a DataSet necessarily.

However, you should be aware that you can construct your own DataSet object,
add a DataTable and add rows to it if you should ever need to.
"darrel" <no*****@hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
I have this:

Dim aFiles as FileInfo() = dirInfo.GetFiles("*.*")

Does this create an array?

I'd like to walk through each item and then render out some text. My
initial
thought was to attach the data to a dataset, walk through it, and then
grab
the info as needed.

I haven't done much with arrays, though, and I can't seem to find an
example
of filling a dataset with anything other than an XML file or DB query.

-Darrel

Nov 19 '05 #2
> However, you should be aware that you can construct your own DataSet
object,
add a DataTable and add rows to it if you should ever need to.


I guess that's my question...how does one do that? I can bind the data right
to a repeater control, for instance, but I'd like to actually walk through
the datarows myself. It seems the easiest way to do that would be to pass
the array data into a dataset. I'm not sure how to go about that, though.

-Darrel
Nov 19 '05 #3
"darrel" <no*****@hotmail.com> wrote in
news:e4*************@TK2MSFTNGP12.phx.gbl:
However, you should be aware that you can construct your own DataSet

object,
add a DataTable and add rows to it if you should ever need to.


I guess that's my question...how does one do that? I can bind the data
right to a repeater control, for instance, but I'd like to actually
walk through the datarows myself. It seems the easiest way to do that
would be to pass the array data into a dataset. I'm not sure how to go
about that, though.

Here's some pseudo code:

Dim DS as New DataSet
Dim DT as New DataTable
Dim DC as New DataColumn("Mycolumn", System.Type.GetType
("System.String")
DT.Columns.add(DC)
DS.Tables.add(DS)

Dim DR as DataRow = DS.Tables(0).NewRow()
DR("MyColumn") = "Hello World"

DS.Tables(0).Rows.add(DR)
The above code will create your own DataSet.

To bind data manually, use the ItemDataBound event.

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemwebuiwebcontrolsdatalistclassitemdatabo undtopic
..asp

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #4
> Here's some pseudo code:

Dim DS as New DataSet
Dim DT as New DataTable
Dim DC as New DataColumn("Mycolumn", System.Type.GetType
("System.String")
DT.Columns.add(DC)
DS.Tables.add(DS)

Dim DR as DataRow = DS.Tables(0).NewRow()
DR("MyColumn") = "Hello World"

DS.Tables(0).Rows.add(DR)


I think I'm missing a key concept here.

So, the above will make a dataset, but where's it getting the data from? How
to I take the data from the FileInfo() object and put it into the ds?

Or, maybe I'm going about this wrong...is it possible to just read through
the FileInfo() object item by item directly?

-Darrel
Nov 19 '05 #5
"darrel" <no*****@hotmail.com> wrote in
news:uK**************@TK2MSFTNGP14.phx.gbl:
Dim DR as DataRow = DS.Tables(0).NewRow()
DR("MyColumn") = "Hello World"

DS.Tables(0).Rows.add(DR)


I think I'm missing a key concept here.

So, the above will make a dataset, but where's it getting the data
from? How to I take the data from the FileInfo() object and put it
into the ds?

Or, maybe I'm going about this wrong...is it possible to just read
through the FileInfo() object item by item directly?


You need to reach item one by one.
For example:

'Get new datarow
Dim DR as DataRow = DS.Tables(0).NewRow()

For each directory as string in FileInfo()
DR("Directory") = directory
'Add row back into table
DS.Tables(0).Rows.add(DR)
Next
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ersin Gençtürk | last post by:
hi , I have 2 tables , tUser and tUserRole and I have a query like : select * from tUser inner join tUserRole on tUserRole.UserId=tUser.UserId where tUser.UserId=1 this will return a user...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
5
by: moondaddy | last post by:
I have a website where cataloge pages are populated by calling a stored procedure on sql server. I use the sql data adapter's fill method to call this stored procedure and fill the dataset. about...
4
by: Manuel | last post by:
I'm using a typed dataset and would like to retrieve a specific table but filtering the rows returned (no point in getting more than what you need, right?). The problem is that the .Fill method of...
1
by: Mrozu | last post by:
Hi I need execute SELECT SQL query in DataSet. No in SQL server(da.selectcommand) and fill dataset, only show in datagrid filtered by select-where query records from dataset:) For example I...
10
by: dauphian | last post by:
Hello, I am new to .net and am trying to build a report application that queries 4 different tables based on a id, and I need to return them in the same table for easy viewing. Basically, I...
2
by: MDB | last post by:
Hello All, I have a data grid that I fill using a dataset. The results of the query has around 15 columns and 500 rows (and growing). The reason I am using the datagrid is so the end users can...
1
by: Deecrypt | last post by:
My issue is that I am communicating data between a website and a webservice using datasets. The datasets created by filling the datasets with results of queries using the DataAdapter. My problem...
11
by: processoriented | last post by:
Hi, I'm something of a noob at this, but here it is... I have an app that fills a dataset from a SQL database, and then writes the dataset to an xml file. Everything is a SELECT query... I am...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.