PC Review


Reply
Thread Tools Rate Thread

Converting Untyped Datasets into Strongly Typed Datasets with Foreign Key Constraints.

 
 
Alex Berryhill
Guest
Posts: n/a
 
      18th Mar 2004
Hi all,

This might seem naive, but been spending quite a bit of time on this;
was wondering if anyone could help me out here.

My problem is as follows:- I have an (MS Data Access Applications
Blocks-generated) untyped dataset that has data grabbed from the
database. I need to convert it into (an already defined) strongly
typed dataset, but one with a foreign key constraint enabled in it
(that is, it has two tables). Any simple way of doing this?

I had, previously, done that for single-table-datasets by declaring
the table name (of the untyped dataset) to be the same as that of its
strongly typed equivalent, and then doing a Merge() for both. I,
obviously, can't do the same thing over here, mainly because of the,
you guessed it, foreign key constraint.

Any help on this would be deeply appreciated.

TIA!
Alex B.
 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      18th Mar 2004
Hi Alex,

"Alex Berryhill" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> This might seem naive, but been spending quite a bit of time on this;
> was wondering if anyone could help me out here.
>
> My problem is as follows:- I have an (MS Data Access Applications
> Blocks-generated) untyped dataset that has data grabbed from the
> database. I need to convert it into (an already defined) strongly
> typed dataset, but one with a foreign key constraint enabled in it
> (that is, it has two tables). Any simple way of doing this?
>
> I had, previously, done that for single-table-datasets by declaring
> the table name (of the untyped dataset) to be the same as that of its
> strongly typed equivalent, and then doing a Merge() for both. I,
> obviously, can't do the same thing over here, mainly because of the,
> you guessed it, foreign key constraint.


Why not?
I mean if you want to have a relation between table it won't let you have
"bad" data because relation enforces consistency.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com


 
Reply With Quote
 
 
 
 
Alex Berryhill
Guest
Posts: n/a
 
      19th Mar 2004
> Why not?
> I mean if you want to have a relation between table it won't let you have
> "bad" data because relation enforces consistency.


What I meant to say was that I was getting an error if I did that.

Fixed it now; all I needed to do was to turn .EnforceConstraints to
false before doing a .Merge()

Thanks anyway for your response!
 
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
what is meant by typed/untyped/strongly typed datasets? Rachana Microsoft VB .NET 4 14th Nov 2007 08:11 PM
How to convert a untyped DataSet object to an strongly typed DataS =?Utf-8?B?R2VyZGE=?= Microsoft ADO .NET 4 9th Sep 2005 08:44 AM
Switching between Strongly typed dataset references and untyped jdipalmajr@comcast.net Microsoft C# .NET 0 21st May 2005 01:38 PM
convert untyped datatable/dataset into strongly typed Somebody_Out_There Microsoft ADO .NET 2 15th May 2004 12:12 AM
convert untyped datatable/dataset into strongly typed Somebody_Out_There Microsoft C# .NET 1 14th May 2004 09:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:52 AM.