PC Review


Reply
Thread Tools Rate Thread

Copy DataRows to Typed DataSet

 
 
Guest
Posts: n/a
 
      8th Aug 2004
Hello,

I developed a custom Windows control that displays a data grid of all orders
for a customer.

Since the control only needs to use the Orders table within the parent data
set (along with the customer ID to filter), it seemed logical to only give
the control what it needs. That's my reasoning for the code below...

\\\
Public Sub New(ByRef Orders As myTypedDataSet.OrdersTable, _
ByVal CustomerID As Integer)

MyBase.New()
InitializeComponent()

dsLocal.Orders = Orders
_Customer_ID = CustomerID

End Sub

Private _CustomerID As Integer
Private dsLocal As myTypedDataSet

Private Sub ctlOrdersForCustomer_Load(ByVal _
sender As System.Object, ByVal e As System.EventArgs) _
Handles MyBase.Load

myDataView.Table = dsLocal.Orders
myDataView.RowFilter = "CustomerID = " & _CustomerID.ToString
myDataView.Sort = "OrderDate DESC"

myGrid.DataSource = myDataView

End Sub
///

My problem is that I can't pass the Orders table as an argument because it
is part of a typed data set. VS.NET complains about dsLocal.Orders being
read-only in the following statement of the constructor:

dsLocal.Orders = Orders

How can I set the local typed dataset table to the incoming parameter? I've
also tried the Copy, ImportRow, and LoadDataRow methods with no luck. Does
anyone know how this can be done?

Thank you very much!

Eric



 
Reply With Quote
 
 
 
 
Andy Becker
Guest
Posts: n/a
 
      9th Aug 2004
<(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> How can I set the local typed dataset table to the incoming parameter?

I've
> also tried the Copy, ImportRow, and LoadDataRow methods with no luck.

Does
> anyone know how this can be done?
>
> Thank you very much!
>
> Eric
>


One way would be to pass OrdersTable.DefaultView as a DataView for the
parameter, instead of the typed dataset itself. Then your existing Load
code (except for the Table = part) could simply work against that view
instead of creating one.

Best Regards,

Andy


 
Reply With Quote
 
Guest
Posts: n/a
 
      9th Aug 2004
Thank you, Andy.

"Andy Becker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > How can I set the local typed dataset table to the incoming parameter?

> I've
> > also tried the Copy, ImportRow, and LoadDataRow methods with no luck.

> Does
> > anyone know how this can be done?
> >
> > Thank you very much!
> >
> > Eric
> >

>
> One way would be to pass OrdersTable.DefaultView as a DataView for the
> parameter, instead of the typed dataset itself. Then your existing Load
> code (except for the Table = part) could simply work against that view
> instead of creating one.
>
> Best Regards,
>
> Andy
>
>



 
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
Referencing Typed DataSet DataRows in .NET 2.0 gauty Microsoft ADO .NET 2 5th Feb 2007 03:09 AM
DataTable.ImportRow() not working? - Strongly typed datarows and tables the problem? Uchiha Jax Microsoft C# .NET 0 1st Mar 2005 08:07 PM
Typed DataSet returned from Web Service missing DataRows Nathan Phelps Microsoft ADO .NET 2 30th Oct 2004 10:42 PM
Copy DataRows to Typed DataSet Microsoft Dot NET Framework Forms 2 9th Aug 2004 04:40 PM
Cast weakly typed DataSet to a strongly typed dataset??? Microsoft Dot NET 0 18th Sep 2003 10:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:10 AM.