DataSet Merge Fails with no error set in datatables or datarows. ?

G

Guest

Hello, I am trying to merge into a dataset and It fails with the following
exception. I would like to know what table is causing this problem. It
looks like one of the data columns names is the source of the problem. I
thought I could catch the merge failed exception but it is not raised. I
also check the ds.HasErrors property after the exception is raised and there
are no errors set in the dataset. What do I have to do to identify
specifically what column in what table in my dataset is causing the problem?

I am simply doing this

ds.Merge( anotherDataSet );


Here is the error.

System.InvalidCastException: Specified cast is not valid.
at System.Data.DataColumnCollection.get_Item(String name)
at System.Data.Merger.MergeSchema(DataTable table)
at System.Data.Merger.MergeTableData(DataTable src)
at System.Data.Merger.MergeDataSet(DataSet source)
at System.Data.DataSet.Merge(DataSet dataSet, Boolean preserveChanges,
MissingSchemaAction missingSchemaAction)
at System.Data.DataSet.Merge(DataSet dataSet)
at Diversa.DeNovoDataAccessLayer.DeNovoDAC.LoadPeptideItem(String
FileName) in
d:\cvs_root\denovoviewer2\denovodataaccesslayer\denovodac.cs:line 126
 
G

Guest

Yes The dataset I am trying to merge into is a typed dataset and the other is
not. This works for me most of the time however.
 
S

Sahil Malik

Thats your problem then .. you are trying to put in the wrong data type into
the strongly typed dataset through the non-strongly typed dataset. In the
specific instance where the exception occurs, write out the non strongly
typed dataset's xml, and you will most certainly find a column/row where the
datatype is incorrect.

- Sahil Malik
You can reach me thru my blog -
http://www.dotnetjunkies.com/weblog/sahilmalik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top