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

Re: DataSet Merge Fails with no error set in datatables or datarows. ? by Sahil

Sahil
Thu Sep 30 16:35:50 CDT 2004

Is either of the merged or mergee .. a strongly typed dataset?

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


"ryanul" <ryanul@discussions.microsoft.com> wrote in message
news:687338B7-4CE9-4FA2-ACD5-93E8590F45E3@microsoft.com...
> 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
>



Re: DataSet Merge Fails with no error set in datatables or datarow by ryanul

ryanul
Thu Sep 30 16:53:03 CDT 2004

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.

"Sahil Malik" wrote:

> Is either of the merged or mergee .. a strongly typed dataset?
>
> - Sahil Malik
> You can reach me thru my blog at
> http://www.dotnetjunkies.com/weblog/sahilmalik
>
>
> "ryanul" <ryanul@discussions.microsoft.com> wrote in message
> news:687338B7-4CE9-4FA2-ACD5-93E8590F45E3@microsoft.com...
> > 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
> >
>
>
>

Re: DataSet Merge Fails with no error set in datatables or datarow by Sahil

Sahil
Fri Oct 01 00:37:35 CDT 2004

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


"ryanul" <ryanul@discussions.microsoft.com> wrote in message
news:7229F99A-7CE7-4840-84CC-DFE96B70299C@microsoft.com...
> 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.
>
> "Sahil Malik" wrote:
>
>> Is either of the merged or mergee .. a strongly typed dataset?
>>
>> - Sahil Malik
>> You can reach me thru my blog at
>> http://www.dotnetjunkies.com/weblog/sahilmalik
>>
>>
>> "ryanul" <ryanul@discussions.microsoft.com> wrote in message
>> news:687338B7-4CE9-4FA2-ACD5-93E8590F45E3@microsoft.com...
>> > 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
>> >
>>
>>
>>