473,383 Members | 1,725 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,383 software developers and data experts.

Copy DataRows to Typed DataSet

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

Nov 21 '05 #1
2 3290
<an*******@discussions.microsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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
Nov 21 '05 #2
Thank you, Andy.

"Andy Becker" <x@x.com> wrote in message
news:uq*************@tk2msftngp13.phx.gbl...
<an*******@discussions.microsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #3

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

Similar topics

0
by: Phil D | last post by:
Hi all, I am stuck over a few issues and hope some of you can help me out. I'll start with the scenario: I have a form with 2 textboxs and 3 buttons on it. Behind this is a dataset into which...
0
by: Uchiha Jax | last post by:
I have used this method many a time in previous applications without any hitches at all and i'm trying to use it in my current application and it isn't working. The only difference I can see is...
0
by: Bennett Haselton | last post by:
If I have just filled a DataTable in a typed DataSet with a single row, is there a way I can make a copy of that row, so that I can clear the DataTable in that DataSet and use it for another query,...
9
by: Brad | last post by:
I have written some code to manipulate data/records in a MASTER (order header) and DETAIL (order details) tables. What I have written is too extensive to post but essentially trying to: 1....
3
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong...
2
by: gl | last post by:
What is the quickest way to get an array of datarows (from a typed dataset) into a dataview (for the purpose of sorting to bind to a datagrid)? Like i have a function that returns...
1
by: Optimus | last post by:
Hi everyone, I currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't...
3
by: creator_bob | last post by:
How do I create an array of datarows from a sorted list? I put a bunch of datarows into a sorted list to sort them. Then I got an array of the sorted elements. However, I cannot typecast them. ...
21
by: Peter Bradley | last post by:
Hi all, This post is sort of tangentially related to my earlier posts on configuration files for DLLs. Does anyone know how to create typed DataSets using VS2005's new DataSet designer, but...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.