Strongly typed dataset - can't find strongly typed row type

Strongly typed dataset - can't find strongly typed row type

Post by Douglas Ta » Mon, 27 Jan 2003 10:17:04



Hello,

I'm using a strongly typed dataset.  When iterating thru the rows
collection, i would prefer to use the strongly typed row data type,
instead of using system.data.datarow.  It doesn't seem to be available
from intellisense, but it compiles correctly and it is a public class.

Is this a vs.net bug?

Thx,
Doug

 
 
 

Strongly typed dataset - can't find strongly typed row type

Post by Roger » Wed, 29 Jan 2003 08:14:03


Try the following (the trick is to put your indexer right after tablename):

(ds1 is a strongly typed containing countries table)
Public Sub iterrate()

Dim cnt As Integer

For cnt = 0 To Ds1.Countries.Rows.Count

Ds1.Countries(cnt).CountryID = 2

Next

End Sub


Quote:> Hello,

> I'm using a strongly typed dataset.  When iterating thru the rows
> collection, i would prefer to use the strongly typed row data type,
> instead of using system.data.datarow.  It doesn't seem to be available
> from intellisense, but it compiles correctly and it is a public class.

> Is this a vs.net bug?

> Thx,
> Doug


 
 
 

Strongly typed dataset - can't find strongly typed row type

Post by Roger » Wed, 29 Jan 2003 08:18:44


Error in Code! dang, that has bit me so many times  :)

Quote:> For cnt = 0 To Ds1.Countries.Rows.Count

should be:

For cnt = 0 To Ds1.Countries.Rows.Count -1


> Try the following (the trick is to put your indexer right after
tablename):

> (ds1 is a strongly typed containing countries table)
> Public Sub iterrate()

> Dim cnt As Integer

> For cnt = 0 To Ds1.Countries.Rows.Count

> Ds1.Countries(cnt).CountryID = 2

> Next

> End Sub



> > Hello,

> > I'm using a strongly typed dataset.  When iterating thru the rows
> > collection, i would prefer to use the strongly typed row data type,
> > instead of using system.data.datarow.  It doesn't seem to be available
> > from intellisense, but it compiles correctly and it is a public class.

> > Is this a vs.net bug?

> > Thx,
> > Doug

 
 
 

Strongly typed dataset - can't find strongly typed row type

Post by Urs Ramsaue » Wed, 29 Jan 2003 19:21:58


why don't you try

foreach([(TypedDataSetName).(TableName)Row] row in
[(TypedDataSetName).(TableName)Table])
{
    // do something with the current row

Quote:}

Imagine you have typed DataSet with the name DS and a Table in it with the
name Table, then
[(TypedDataSetName).(TableName)Row] would mean DS.TableRow and
[(TypedDataSetName).(TableName)Table] would mean DS.TableTable

Urs

 
 
 

1. Strongly typed DataTable with loosely typed DataSet

 I have not played with strongly typed dataset much.
 If the answer is obvious, please pardon me.

Strongly typed dataset is exciting.

I wonder if I can create few strongly typed data tables
and assemble a data set at runtime.

Example:
    Dataset1:    Order, OrderItems
    Dataset2:    Invoice, Orders
    Dataset3:    Customer, Invoices
    Dataset4:    Customer, Users, UserProfile

As you can see, Customer, Invoice, Order, and OrderItem
are combined in different ways in different application context.
In my 'real-world' there are many more base types
with numerous combinations in different application scenarios.
(Most of the scenarios are read-only, few updateable)

Q1:    If I generate two strongly typed datasets, say for example
          Dataset1 and Dataset2, will I end up with two distinct
         Order types (Identical, but distinct for the type system)

Q2:    I would like to define few strongly typed DataTables,
         but assemble loosely typed dataset at runtime,
         and load data using DataAdapters which will
         fill the Customer DataTable irrespective of
         which dataset it is used?

Venkatesh.R

2. CZ, the place to buy portables

3. Strongly Typed Datasets, New Rows, and Concurrency

4. PS -> SYS fonts

5. Strongly Typed DataSet stops returning rows

6. Part time Consulting

7. Convert Strongly Typed Object to Un-typed

8. netcom replies

9. Are strongly typed DataSet's more preformant?

10. Experiences with DataReader \ DataSet \ Custom Strongly Type DataSet

11. Major Problem downcasting from DataSets to Strongly typed datasets across dlls

12. Problem Casting from Dataset to Strongly Typed Dataset

13. Strongly typed CUSTOM Dataset DBNull handling vs generated dataset