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

DataSet V2: Merge problem

We converted our app from 1.1 to 2 and some code was no longer working.
The case: From a non typed datatable, convert it to a typed one.

How to reproduce the bug:
-------------------------------
1) Create a project.
2) Add a new Dataset (keep DataSet1).
a) Add a new DataTable (Keep DataTable1)
b) Add a new DataColumn (Keep DataColumn1)
3) Add a new Window form.
4) Add a button.
5) Add button click event and add the following code:

***** Code : Start *****
// We defined a non-typed DataTable in a Dataset.
DataSet mDataset = new DataSet();
DataTable mDataTable = mDataset.Tables.Add("DataTable1");
DataColumn mDataColumn = mDataTable.Columns.Add("Column1");
mDataColumn.DataType = typeof(string);

// Adding a row in the non-typed DataTable.
mDataset.Tables[0].Rows.Add(new object[] { "A" });

// Temporary Typed Dataset to transfer.
DataSet1 mTmpds = new DataSet1();
mTmpds.Merge(mDataset.Tables[0], false, MissingSchemaAction.Ignore);

// Removing the non-typed and merging the Typed.
mDataset.Tables.RemoveAt(0);
mDataset.Merge(mTmpds);

// Trying to access Column1 and show the value.
Console.WriteLine(((DataSet1.DataTable1DataTable)m Dataset.Tables[0])[0].Column1);
***** Code : End *****

Note:
The problem seam to be the non transfer of the column table reference. Look
like to be linked to the old table. I checked the code and found that it is
because the column property "Table" is not the same has the table object.

MS Code: DataRow - private void CheckColumn(DataColumn column)
-----------
....
if (column.Table != this._table)
{
throw ExceptionBuilder.ColumnNotInTheTable(column.Column Name,
this._table.TableName);
}

That was working in DotNet 1.1.
Mar 24 '06 #1
0 1024

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

Similar topics

8
by: Bruce Stockwell | last post by:
the setup: Webservice/WinClient application/SQL server. VS.Net (visual basic) winform wizard creates a simple form with load cancel cancelall and datagrid bound to a simple Dataset with one...
4
by: Steve Donnor | last post by:
Here's my question.. I have a Dataset which has populated a datagrid with information from an AS400 That SQL looks like this "Select MASYS, MAFLD, MADATA, MAEQV from QS36F.MAPDATA WHERE MASYS =...
3
by: Bernard | last post by:
How can I cast the dataset I generated the dataset from schema and named it 'Staff'. I use this dataset (staff dataset) as a datasource in the report then I would like to generate the data from...
0
by: TK | last post by:
Hi, I need help on datagrid. I have a dataset exposed as a webservice. I do have a web application that is supposed to consume the service on a datagrid.
2
by: muntyanu | last post by:
Hi all, I have problem when merging existing DataTable into new dataset. DataSet ds = new DataSet(); while ( done ) { // fill myCustomDataSet.MyTable with data ds.Merge(...
5
by: vaj | last post by:
Hey, Im creating a system on a pocket pc based on win ce 4.2 and i need to tranfer three datasets to a remote server on the network.Could anyone tell me the easiest way to do this? cheers, -vaj
4
by: Al | last post by:
I have this scenario: 1. XML file with schema and data is created from SQL Server tables. XML file contains 6 tables, some of them have rows, some of them are empty. 2. XML file is given to the...
5
by: Mark Chambers | last post by:
Hi there, Can anyone explain the following (very) simple scenario. 1) I make an exact copy of my "DataSet" and delete one record from a given table (in the copy) 2) I invoke...
2
by: Neil Chambers | last post by:
I am trying to get my head around dataset merging but despite a little research I could still use a pointer (or ten). Basically I want to perform an outer join operation on a dataset (created from...
1
by: joproulx | last post by:
Hello all, Here is my problem: I am trying to merge 2 datasets but I don't want to overwrite rows that are already modified in my working dataset. Example: I have one Dataset with only one...
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:
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.