Home All Groups Group Topic Archive Search About

how to construct a Schema

Author
28 Feb 2005 12:21 AM
RayAll
Hi,

I have a table which has 3 forign keys to three other tables.I's to make an
schema out of this table which contains all the constrainsts and all its
relations and also I'l like to have the records from the look-up tables to
be included into that schema.The reason I like the data is that .I want to
pump data into a dataset ,but I want to make sure that no viloation
happens,I mean I want to make sure that when I pump data into the dataset
for the field country code for example ,the related table contains that code
for sure.

Is there somebody who can help me.

Thanks
Author
28 Feb 2005 4:19 PM
Sahil Malik
Ray,

You can make a schema in 3 ways --

a) Programatically on a dataset.
b) By manually writing up an XSD
c) By creating an XSD via the Visual Studio strongly typed dataset designer.

Also you can do fillschema, but that defeats your purpose here I think?

That will take care of "Constraints and Relations".

Regards the "Records from lookup tables to be included in that schema" --
Well technically that is data, and data cannot be a part of Schema, so you
cannot specify that as any of the above HOWEVER, you can easily acheieve
that by doing a "Fill" operation with the necessary
ForeignKeyConstraints/DataRelations enforced. Given that you have such a
constraint defined, the child table may or may not contain the childrows
(yet), and during fill they will be validated against this constraint -
which is what you need. :)

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/



Show quoteHide quote
"RayAll" <Ray***@microsft.com> wrote in message
news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I have a table which has 3 forign keys to three other tables.I's to make
an
> schema out of this table which contains all the constrainsts and all its
> relations and also I'l like to have the records from the look-up tables to
> be included into that schema.The reason I like the data is that .I want to
> pump data into a dataset ,but I want to make sure that no viloation
> happens,I mean I want to make sure that when I pump data into the dataset
> for the field country code for example ,the related table contains that
code
> for sure.
>
> Is there somebody who can help me.
>
> Thanks
>
>
Are all your drivers up to date? click for free checkup

Author
1 Mar 2005 5:16 PM
RayAll
Can I define an specific format for a column in Schema?
for instance for one column I'd like the data to like this format "dd/dd/dd"
..

Thanks
Show quoteHide quote
"Sahil Malik" <contactmethrumyblog@nospam.com> wrote in message
news:eXz7CFbHFHA.2860@TK2MSFTNGP12.phx.gbl...
> Ray,
>
> You can make a schema in 3 ways --
>
> a) Programatically on a dataset.
> b) By manually writing up an XSD
> c) By creating an XSD via the Visual Studio strongly typed dataset
> designer.
>
> Also you can do fillschema, but that defeats your purpose here I think?
>
> That will take care of "Constraints and Relations".
>
> Regards the "Records from lookup tables to be included in that schema" --
> Well technically that is data, and data cannot be a part of Schema, so you
> cannot specify that as any of the above HOWEVER, you can easily acheieve
> that by doing a "Fill" operation with the necessary
> ForeignKeyConstraints/DataRelations enforced. Given that you have such a
> constraint defined, the child table may or may not contain the childrows
> (yet), and during fill they will be validated against this constraint -
> which is what you need. :)
>
> - Sahil Malik
> http://codebetter.com/blogs/sahil.malik/
>
>
>
> "RayAll" <Ray***@microsft.com> wrote in message
> news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
>> Hi,
>>
>> I have a table which has 3 forign keys to three other tables.I's to make
> an
>> schema out of this table which contains all the constrainsts and all its
>> relations and also I'l like to have the records from the look-up tables
>> to
>> be included into that schema.The reason I like the data is that .I want
>> to
>> pump data into a dataset ,but I want to make sure that no viloation
>> happens,I mean I want to make sure that when I pump data into the dataset
>> for the field country code for example ,the related table contains that
> code
>> for sure.
>>
>> Is there somebody who can help me.
>>
>> Thanks
>>
>>
>
>
Author
1 Mar 2005 10:04 PM
Sahil Malik
I don't think so .. though I don't claim to be an XSD expert. But you can
restrict to a date data type.

But you can acheive the same result by hooking onto the RowChanging event on
a Table, and latching onto the new row, appropriate column and writing some
C# goo around formatting.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/






"RayAll" <Ray***@microsft.com> wrote in message
news:O5#n0JoHFHA.1172@TK2MSFTNGP12.phx.gbl...
> Can I define an specific format for a column in Schema?
> for instance for one column I'd like the data to like this format
"dd/dd/dd"
Show quoteHide quote
> .
>
> Thanks
> "Sahil Malik" <contactmethrumyblog@nospam.com> wrote in message
> news:eXz7CFbHFHA.2860@TK2MSFTNGP12.phx.gbl...
> > Ray,
> >
> > You can make a schema in 3 ways --
> >
> > a) Programatically on a dataset.
> > b) By manually writing up an XSD
> > c) By creating an XSD via the Visual Studio strongly typed dataset
> > designer.
> >
> > Also you can do fillschema, but that defeats your purpose here I think?
> >
> > That will take care of "Constraints and Relations".
> >
> > Regards the "Records from lookup tables to be included in that
schema" --
> > Well technically that is data, and data cannot be a part of Schema, so
you
> > cannot specify that as any of the above HOWEVER, you can easily acheieve
> > that by doing a "Fill" operation with the necessary
> > ForeignKeyConstraints/DataRelations enforced. Given that you have such a
> > constraint defined, the child table may or may not contain the childrows
> > (yet), and during fill they will be validated against this constraint -
> > which is what you need. :)
> >
> > - Sahil Malik
> > http://codebetter.com/blogs/sahil.malik/
> >
> >
> >
> > "RayAll" <Ray***@microsft.com> wrote in message
> > news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
> >> Hi,
> >>
> >> I have a table which has 3 forign keys to three other tables.I's to
make
> > an
> >> schema out of this table which contains all the constrainsts and all
its
> >> relations and also I'l like to have the records from the look-up tables
> >> to
> >> be included into that schema.The reason I like the data is that .I want
> >> to
> >> pump data into a dataset ,but I want to make sure that no viloation
> >> happens,I mean I want to make sure that when I pump data into the
dataset
> >> for the field country code for example ,the related table contains that
> > code
> >> for sure.
> >>
> >> Is there somebody who can help me.
> >>
> >> Thanks
> >>
> >>
> >
> >
>
>
Author
1 Mar 2005 12:01 AM
Val Mazur
Hi,

What you could do is to create relations between you DataTables inside of
the DataSet. It will enforce checking of the constraints to allow only
valid. Check DataRelation class and ForeignKeyConstraint class for it.

--
Val Mazur
Microsoft MVP

http://xport.mvps.org

Show quoteHide quote
"RayAll" <Ray***@microsft.com> wrote in message
news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I have a table which has 3 forign keys to three other tables.I's to make
> an
> schema out of this table which contains all the constrainsts and all its
> relations and also I'l like to have the records from the look-up tables to
> be included into that schema.The reason I like the data is that .I want to
> pump data into a dataset ,but I want to make sure that no viloation
> happens,I mean I want to make sure that when I pump data into the dataset
> for the field country code for example ,the related table contains that
> code
> for sure.
>
> Is there somebody who can help me.
>
> Thanks
>
>
Author
1 Mar 2005 5:20 PM
RayAll
Ok ,I defined the schema by using Visual Studio Designer
Now how can I make a Strongly-Typed Dataset agianst it?
Should I use the command tools or I can do it directly from VS2003?

Thanks for your help.


Show quoteHide quote
"RayAll" <Ray***@microsft.com> wrote in message
news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
> Hi,
>
> I have a table which has 3 forign keys to three other tables.I's to make
> an
> schema out of this table which contains all the constrainsts and all its
> relations and also I'l like to have the records from the look-up tables to
> be included into that schema.The reason I like the data is that .I want to
> pump data into a dataset ,but I want to make sure that no viloation
> happens,I mean I want to make sure that when I pump data into the dataset
> for the field country code for example ,the related table contains that
> code
> for sure.
>
> Is there somebody who can help me.
>
> Thanks
>
>
Author
1 Mar 2005 10:04 PM
Sahil Malik
It doesn't matter if you use VS2003, or XSD.exe, the result is the same.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/



Show quoteHide quote
"RayAll" <Ray***@microsft.com> wrote in message
news:#Zi4AMoHFHA.3040@TK2MSFTNGP10.phx.gbl...
> Ok ,I defined the schema by using Visual Studio Designer
> Now how can I make a Strongly-Typed Dataset agianst it?
> Should I use the command tools or I can do it directly from VS2003?
>
> Thanks for your help.
>
>
> "RayAll" <Ray***@microsft.com> wrote in message
> news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > I have a table which has 3 forign keys to three other tables.I's to make
> > an
> > schema out of this table which contains all the constrainsts and all its
> > relations and also I'l like to have the records from the look-up tables
to
> > be included into that schema.The reason I like the data is that .I want
to
> > pump data into a dataset ,but I want to make sure that no viloation
> > happens,I mean I want to make sure that when I pump data into the
dataset
> > for the field country code for example ,the related table contains that
> > code
> > for sure.
> >
> > Is there somebody who can help me.
> >
> > Thanks
> >
> >
>
>
Author
2 Mar 2005 11:41 PM
RayAll
how can I make a Strongly-Typed Dataset agianst it?

Thanks Sahil,

Show quoteHide quote
"Sahil Malik" <contactmethrumyblog@nospam.com> wrote in message
news:%23Mi%23kqqHFHA.904@tk2msftngp13.phx.gbl...
> It doesn't matter if you use VS2003, or XSD.exe, the result is the same.
>
> - Sahil Malik
> http://codebetter.com/blogs/sahil.malik/
>
>
>
> "RayAll" <Ray***@microsft.com> wrote in message
> news:#Zi4AMoHFHA.3040@TK2MSFTNGP10.phx.gbl...
>> Ok ,I defined the schema by using Visual Studio Designer
>> Now how can I make a Strongly-Typed Dataset agianst it?
>> Should I use the command tools or I can do it directly from VS2003?
>>
>> Thanks for your help.
>>
>>
>> "RayAll" <Ray***@microsft.com> wrote in message
>> news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
>> > Hi,
>> >
>> > I have a table which has 3 forign keys to three other tables.I's to
>> > make
>> > an
>> > schema out of this table which contains all the constrainsts and all
>> > its
>> > relations and also I'l like to have the records from the look-up tables
> to
>> > be included into that schema.The reason I like the data is that .I want
> to
>> > pump data into a dataset ,but I want to make sure that no viloation
>> > happens,I mean I want to make sure that when I pump data into the
> dataset
>> > for the field country code for example ,the related table contains that
>> > code
>> > for sure.
>> >
>> > Is there somebody who can help me.
>> >
>> > Thanks
>> >
>> >
>>
>>
>
>
Author
3 Mar 2005 12:15 PM
Sahil Malik
Okay there are 2 ways to make a strongly typed dataset. This is described in
Chapter 5 in my first book and Chapter 6 in my second.

Once you have the XSD authored -

1. The manual way. Run the xsd.exe tool to generate the strongly typed
dataset code.
2. The visual studio way. Drag drop the XSD to your project (yes it's that
simple). OR author the XSD in Vstudio by right click --> Add new dataset,
and author the schema right there using point and click.

Just one important point of note - not every xsd qualifies to be a dataset.
I believe in .NET 2.0 there is a InferSchema class that has an IsDataset
property on it. (Or was it also available on the
System.Xml.Schemas.XmlSchema class? My memory is a bit hazy there, but
that's a way of checking IF a schema qualifies to be a dataset or not.

HTH :)


Show quoteHide quote
"RayAll" <Ray***@microsft.com> wrote in message
news:eUYecF4HFHA.2156@TK2MSFTNGP09.phx.gbl...
> how can I make a Strongly-Typed Dataset agianst it?
>
> Thanks Sahil,
>
> "Sahil Malik" <contactmethrumyblog@nospam.com> wrote in message
> news:%23Mi%23kqqHFHA.904@tk2msftngp13.phx.gbl...
>> It doesn't matter if you use VS2003, or XSD.exe, the result is the same.
>>
>> - Sahil Malik
>> http://codebetter.com/blogs/sahil.malik/
>>
>>
>>
>> "RayAll" <Ray***@microsft.com> wrote in message
>> news:#Zi4AMoHFHA.3040@TK2MSFTNGP10.phx.gbl...
>>> Ok ,I defined the schema by using Visual Studio Designer
>>> Now how can I make a Strongly-Typed Dataset agianst it?
>>> Should I use the command tools or I can do it directly from VS2003?
>>>
>>> Thanks for your help.
>>>
>>>
>>> "RayAll" <Ray***@microsft.com> wrote in message
>>> news:e4dEztSHFHA.2976@TK2MSFTNGP15.phx.gbl...
>>> > Hi,
>>> >
>>> > I have a table which has 3 forign keys to three other tables.I's to
>>> > make
>>> > an
>>> > schema out of this table which contains all the constrainsts and all
>>> > its
>>> > relations and also I'l like to have the records from the look-up
>>> > tables
>> to
>>> > be included into that schema.The reason I like the data is that .I
>>> > want
>> to
>>> > pump data into a dataset ,but I want to make sure that no viloation
>>> > happens,I mean I want to make sure that when I pump data into the
>> dataset
>>> > for the field country code for example ,the related table contains
>>> > that
>>> > code
>>> > for sure.
>>> >
>>> > Is there somebody who can help me.
>>> >
>>> > Thanks
>>> >
>>> >
>>>
>>>
>>
>>
>
>

Bookmark and Share

Post Thread options