PC Review


Reply
Thread Tools Rate Thread

An array of datasets/tables ?

 
 
Aussie Rules
Guest
Posts: n/a
 
      9th Oct 2009
Hi,

I have a query that returns a datatset, that contains a table that holds a
bunch of data. One of the columns is "lift_id"

The lift id shows what lift needs to be uses, and for different people using
the application there will be a different number of lifts.

What I need to be able to do is to somehow dynamicly create a number of in
memory tables(as I have no need to keep, and they last only for a few
minutes each time), each containing the data for the lift. For example,
dataset 1 contains all the information for lift 1, dataset 2 contains all
the information for lift 2 and so on. Because the number of lifts will
always be different, then I can't fix the number of datasets.

Once this is done, I have to step through each dataset, and as some lifts
are faster than others, I need to be able to move/step through the dataset
item by item, but always be able to see what lift is doing what item.

Is there away I can do this ?



 
Reply With Quote
 
 
 
 
Harry Strybos
Guest
Posts: n/a
 
      9th Oct 2009
"Aussie Rules" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> I have a query that returns a datatset, that contains a table that holds a
> bunch of data. One of the columns is "lift_id"
>
> The lift id shows what lift needs to be uses, and for different people
> using the application there will be a different number of lifts.
>
> What I need to be able to do is to somehow dynamicly create a number of in
> memory tables(as I have no need to keep, and they last only for a few
> minutes each time), each containing the data for the lift. For example,
> dataset 1 contains all the information for lift 1, dataset 2 contains all
> the information for lift 2 and so on. Because the number of lifts will
> always be different, then I can't fix the number of datasets.
>
> Once this is done, I have to step through each dataset, and as some lifts
> are faster than others, I need to be able to move/step through the dataset
> item by item, but always be able to see what lift is doing what item.
>
> Is there away I can do this ?
>
>

Hope I am not of mark with this but maybe a cursor query can do this. My
assumption is that you know that a dataset can contain more than one table.

So something like (in a stored proc cursor):

1. List all lifts in use
2. For each lift select whatever data for this lift

Hope I don't patronise by saying again, that a dataset can contain many
tables eg

Select * From Lift Where Lift_ID = 1
Select * From Lift Where Lift_ID = 2
will return a dataset with two tables so you access them by:

For Each row as Datarow in ds.Tables(n).Rows 'etc

Hope that helps......


 
Reply With Quote
 
Miro
Guest
Posts: n/a
 
      9th Oct 2009
I am not sure I exactly know what you are trying to sort through - so sorry
if I misunderstood you.

What about creating a class with a property that is a dataset.

Then instantiate that class with a "List( of T )"...
and keep adding to that one. Here since you can add as many properties as
you need with your class, you can make properties such as "lift id",
"dataset", "some other informaiton what lift id is doing"



that or creating a hash table the id is the LiftID, - something like this:
Dim LiftIDs As New Hashtable
LiftIDs.Add(LiftIDs, dataset)




"Aussie Rules" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> I have a query that returns a datatset, that contains a table that holds a
> bunch of data. One of the columns is "lift_id"
>
> The lift id shows what lift needs to be uses, and for different people
> using the application there will be a different number of lifts.
>
> What I need to be able to do is to somehow dynamicly create a number of in
> memory tables(as I have no need to keep, and they last only for a few
> minutes each time), each containing the data for the lift. For example,
> dataset 1 contains all the information for lift 1, dataset 2 contains all
> the information for lift 2 and so on. Because the number of lifts will
> always be different, then I can't fix the number of datasets.
>
> Once this is done, I have to step through each dataset, and as some lifts
> are faster than others, I need to be able to move/step through the dataset
> item by item, but always be able to see what lift is doing what item.
>
> Is there away I can do this ?
>
>
>


 
Reply With Quote
 
Miro
Guest
Posts: n/a
 
      9th Oct 2009
I created this for you... here is the button code:
Hope this helps:


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim Lifts As New List(Of MyLifts)
Dim myds As New DataSet 'Temp Dataset for example purposes
'Putting data in
For nI As Integer = 1 To 5
Dim TempLifts As New MyLifts
TempLifts.LiftDataset = myds
TempLifts.LiftId = nI.ToString
Lifts.Add(TempLifts)
Next

'Retrieving data
For nI As Integer = 0 To (Lifts.Count - 1)
Dim LiftId As String = Lifts(nI).LiftId
Dim LiftDataset As DataSet = Lifts(nI).LiftDataset
Next

End Sub

and a class I created:
Public Class MyLifts

Private _LiftID As String
Private _LiftDataset As DataSet

Public Property LiftId() As String
Get
Return _LiftID
End Get
Set(ByVal value As String)
_LiftID = value
End Set
End Property

Public Property LiftDataset() As DataSet
Get
Return _LiftDataset
End Get
Set(ByVal value As DataSet)
_LiftDataset = value
End Set
End Property

End Class



====
Cheers'

Miro

"Your Name Here" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)160N...
> Miro wrote:
>> I am not sure I exactly know what you are trying to sort through - so
>> sorry
>> if I misunderstood you.
>>
>> What about creating a class with a property that is a dataset.
>>
>> Then instantiate that class with a "List( of T )"...
>> and keep adding to that one. Here since you can add as many properties
>> as
>> you need with your class, you can make properties such as "lift id",
>> "dataset", "some other informaiton what lift id is doing"
>>
>>
>>
>> that or creating a hash table the id is the LiftID, - something like
>> this:
>> Dim LiftIDs As New Hashtable
>> LiftIDs.Add(LiftIDs, dataset)
>>
>>
>>
>>
>> "Aussie Rules" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Hi,
>>>
>>> I have a query that returns a datatset, that contains a table that holds
>>> a
>>> bunch of data. One of the columns is "lift_id"
>>>
>>> The lift id shows what lift needs to be uses, and for different people
>>> using the application there will be a different number of lifts.
>>>
>>> What I need to be able to do is to somehow dynamicly create a number of
>>> in
>>> memory tables(as I have no need to keep, and they last only for a few
>>> minutes each time), each containing the data for the lift. For example,
>>> dataset 1 contains all the information for lift 1, dataset 2 contains
>>> all
>>> the information for lift 2 and so on. Because the number of lifts will
>>> always be different, then I can't fix the number of datasets.
>>>
>>> Once this is done, I have to step through each dataset, and as some
>>> lifts
>>> are faster than others, I need to be able to move/step through the
>>> dataset
>>> item by item, but always be able to see what lift is doing what item.
>>>
>>> Is there away I can do this ?
>>>
>>>
>>>

>>

> Hi Miro.
>
> Thanks for your reply.
>
> I like the idea of using a class where I can add a dataset as a property.
>
> I have only played a bit with classes, and only with strings and integers.
> I
> did actually start to create a class for the lift, but didn't know that
> you
> could have a dataset as a property. How do you declare a property that
> is a
> dataset ?
>
> I assume that to retrieve the dataset one would go dim ds as dataset =
> classname.datasetPropertyName ?
>
> Is that correct.
>
> Thanks....


 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      11th Oct 2009
You can do it, as long as there is only one computer for all lifts, however,
it is a very much horse behind the cart method.

For this is OO (not OOP) created. Simply creating a class for your Lifts
which you put inside a (more) Generic lists makes it a lot easier.

Cor


"Aussie Rules" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi,
>
> I have a query that returns a datatset, that contains a table that holds a
> bunch of data. One of the columns is "lift_id"
>
> The lift id shows what lift needs to be uses, and for different people
> using the application there will be a different number of lifts.
>
> What I need to be able to do is to somehow dynamicly create a number of in
> memory tables(as I have no need to keep, and they last only for a few
> minutes each time), each containing the data for the lift. For example,
> dataset 1 contains all the information for lift 1, dataset 2 contains all
> the information for lift 2 and so on. Because the number of lifts will
> always be different, then I can't fix the number of datasets.
>
> Once this is done, I have to step through each dataset, and as some lifts
> are faster than others, I need to be able to move/step through the dataset
> item by item, but always be able to see what lift is doing what item.
>
> Is there away I can do this ?
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Joining tables from 2 datasets Peter Microsoft ASP .NET 4 8th Jun 2009 04:27 PM
typed datasets - multiple tables figital Microsoft VB .NET 0 9th Mar 2006 02:28 PM
Array of datasets.... =?Utf-8?B?RGlvZ28gQWx2ZXMgLSBTb2Z0d2FyZSBEZXZlbG9w Microsoft C# .NET 1 3rd Feb 2006 06:22 PM
Copying tables between datasets =?Utf-8?B?TWljaGFlbCBBbGJhbmVzZQ==?= Microsoft Dot NET 1 29th Jul 2004 09:08 PM
Datasets vs Tables =?Utf-8?B?RGF2ZSBNb3lsZQ==?= Microsoft ADO .NET 11 28th May 2004 06:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:32 PM.