Showing posts with label datasets. Show all posts
Showing posts with label datasets. Show all posts

Thursday, March 22, 2012

Strongly Type Datasets

I am trying to create a strongly typed dataset is VS 2005 with the VS
creating the stored procedures. It won't create the stored procedures. The
SQL script it generates is based on a SQL login so the script looks
something like:

DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE

these scripts won't work until I change the script to:

DROP PROCEDURE dbo.WEB_PAGE_UPDATE

What am I doing wrong? I suspect I doing my connectionstring wrong in some
way or my permissions are wrong in SQL Server.

Regards, Chris.Is there a setting for the database "Schema Name" somewhere on the
properties of the data set? That's what's being prepended to the table name.

"Chris" <nospam@.nospam.comwrote in message
news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>I am trying to create a strongly typed dataset is VS 2005 with the VS
>creating the stored procedures. It won't create the stored procedures. The
>SQL script it generates is based on a SQL login so the script looks
>something like:
>
DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
>
these scripts won't work until I change the script to:
>
DROP PROCEDURE dbo.WEB_PAGE_UPDATE
>
What am I doing wrong? I suspect I doing my connectionstring wrong in some
way or my permissions are wrong in SQL Server.
>
Regards, Chris.
>


No I can't find it. Any clues where abouts I might find it. I have looked on
the properties on of the dataset etc.

"KJ" <n_o_s_p_a__M@.Mail.comwrote in message
news:OFjUR$GoHHA.716@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

Is there a setting for the database "Schema Name" somewhere on the
properties of the data set? That's what's being prepended to the table
name.
>
"Chris" <nospam@.nospam.comwrote in message
news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>>I am trying to create a strongly typed dataset is VS 2005 with the VS
>>creating the stored procedures. It won't create the stored procedures. The
>>SQL script it generates is based on a SQL login so the script looks
>>something like:
>>
>DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
>>
>these scripts won't work until I change the script to:
>>
>DROP PROCEDURE dbo.WEB_PAGE_UPDATE
>>
>What am I doing wrong? I suspect I doing my connectionstring wrong in
>some way or my permissions are wrong in SQL Server.
>>
>Regards, Chris.
>>


>
>


Which version of SQL Server? If 2005, go to the properties page of the login
you are using (via Management Studio), and check the value for Default
Schema for that login. My guess is that it's not dbo. But this is just a
guess.

"Chris" <nospam@.nospam.comwrote in message
news:OxkTYdHoHHA.4124@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

No I can't find it. Any clues where abouts I might find it. I have looked
on the properties on of the dataset etc.
>
"KJ" <n_o_s_p_a__M@.Mail.comwrote in message
news:OFjUR$GoHHA.716@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>Is there a setting for the database "Schema Name" somewhere on the
>properties of the data set? That's what's being prepended to the table
>name.
>>
>"Chris" <nospam@.nospam.comwrote in message
>news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>>>I am trying to create a strongly typed dataset is VS 2005 with the VS
>>>creating the stored procedures. It won't create the stored procedures.
>>>The SQL script it generates is based on a SQL login so the script looks
>>>something like:
>>>
>>DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
>>>
>>these scripts won't work until I change the script to:
>>>
>>DROP PROCEDURE dbo.WEB_PAGE_UPDATE
>>>
>>What am I doing wrong? I suspect I doing my connectionstring wrong in
>>some way or my permissions are wrong in SQL Server.
>>>
>>Regards, Chris.
>>>


>>
>>


>
>


Sorry I must be missing something. When you say "check for default schema",
I can't find it it. It is SQL 2005. I have gone to the login propeties page
of the login (in SQL 2005), gone to user mapping and put the default scheme
over to do_owner but the sql scripts generated are still this same in VS
2005

"KJ" <n_o_s_p_a__M@.Mail.comwrote in message
news:O7IrnYJoHHA.1476@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

Which version of SQL Server? If 2005, go to the properties page of the
login you are using (via Management Studio), and check the value for
Default Schema for that login. My guess is that it's not dbo. But this is
just a guess.
>
"Chris" <nospam@.nospam.comwrote in message
news:OxkTYdHoHHA.4124@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>No I can't find it. Any clues where abouts I might find it. I have looked
>on the properties on of the dataset etc.
>>
>"KJ" <n_o_s_p_a__M@.Mail.comwrote in message
>news:OFjUR$GoHHA.716@.TK2MSFTNGP05.phx.gbl...

Quote:

Originally Posted by

>>Is there a setting for the database "Schema Name" somewhere on the
>>properties of the data set? That's what's being prepended to the table
>>name.
>>>
>>"Chris" <nospam@.nospam.comwrote in message
>>news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...
>>I am trying to create a strongly typed dataset is VS 2005 with the VS
>>creating the stored procedures. It won't create the stored procedures.
>>The SQL script it generates is based on a SQL login so the script looks
>>something like:
>>
>>>DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
>>
>>>these scripts won't work until I change the script to:
>>
>>>DROP PROCEDURE dbo.WEB_PAGE_UPDATE
>>
>>>What am I doing wrong? I suspect I doing my connectionstring wrong in
>>>some way or my permissions are wrong in SQL Server.
>>
>>>Regards, Chris.
>>
>>>
>>>


>>
>>


>
>


"db_owner" is a role, not a schema; "dbo" is a schema.

When you look at the name of the table in the Object Explorer (of Management
Studio), what is it? Is it dbo.TableName, or WebManagerV2.TableName?

"Chris" <nospam@.nospam.comwrote in message
news:O7PiG6KoHHA.5052@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

Sorry I must be missing something. When you say "check for default
schema", I can't find it it. It is SQL 2005. I have gone to the login
propeties page of the login (in SQL 2005), gone to user mapping and put
the default scheme over to do_owner but the sql scripts generated are
still this same in VS 2005
>
>
"KJ" <n_o_s_p_a__M@.Mail.comwrote in message
news:O7IrnYJoHHA.1476@.TK2MSFTNGP03.phx.gbl...

Quote:

Originally Posted by

>Which version of SQL Server? If 2005, go to the properties page of the
>login you are using (via Management Studio), and check the value for
>Default Schema for that login. My guess is that it's not dbo. But this is
>just a guess.
>>
>"Chris" <nospam@.nospam.comwrote in message
>news:OxkTYdHoHHA.4124@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

>>No I can't find it. Any clues where abouts I might find it. I have
>>looked on the properties on of the dataset etc.
>>>
>>"KJ" <n_o_s_p_a__M@.Mail.comwrote in message
>>news:OFjUR$GoHHA.716@.TK2MSFTNGP05.phx.gbl...
>>>Is there a setting for the database "Schema Name" somewhere on the
>>>properties of the data set? That's what's being prepended to the table
>>>name.
>>
>>>"Chris" <nospam@.nospam.comwrote in message
>>>news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...
>>I am trying to create a strongly typed dataset is VS 2005 with the VS
>>creating the stored procedures. It won't create the stored procedures.
>>The SQL script it generates is based on a SQL login so the script looks
>>something like:
>>
>>DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
>>
>>these scripts won't work until I change the script to:
>>
>>DROP PROCEDURE dbo.WEB_PAGE_UPDATE
>>
>>What am I doing wrong? I suspect I doing my connectionstring wrong in
>>some way or my permissions are wrong in SQL Server.
>>
>>Regards, Chris.
>>
>>
>>
>>>
>>>


>>
>>


>
>

Strongly Type Datasets

I am trying to create a strongly typed dataset is VS 2005 with the VS
creating the stored procedures. It won't create the stored procedures. The
SQL script it generates is based on a SQL login so the script looks
something like:
DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
these scripts won't work until I change the script to:
DROP PROCEDURE dbo.WEB_PAGE_UPDATE
What am I doing wrong? I suspect I doing my connectionstring wrong in some
way or my permissions are wrong in SQL Server.
Regards, Chris.Is there a setting for the database "Schema Name" somewhere on the
properties of the data set? That's what's being prepended to the table name.
"Chris" <nospam@.nospam.com> wrote in message
news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...
>I am trying to create a strongly typed dataset is VS 2005 with the VS
>creating the stored procedures. It won't create the stored procedures. The
>SQL script it generates is based on a SQL login so the script looks
>something like:
> DROP PROCEDURE WebManagerV2.WEB_PAGE_UPDATE
> these scripts won't work until I change the script to:
> DROP PROCEDURE dbo.WEB_PAGE_UPDATE
> What am I doing wrong? I suspect I doing my connectionstring wrong in some
> way or my permissions are wrong in SQL Server.
> Regards, Chris.
>
Which version of SQL Server? If 2005, go to the properties page of the login
you are using (via Management Studio), and check the value for Default
Schema for that login. My guess is that it's not dbo. But this is just a
guess.
"Chris" <nospam@.nospam.com> wrote in message
news:OxkTYdHoHHA.4124@.TK2MSFTNGP02.phx.gbl...
> No I can't find it. Any clues where abouts I might find it. I have looked
> on the properties on of the dataset etc.
> "KJ" <n_o_s_p_a__M@.Mail.com> wrote in message
> news:OFjUR$GoHHA.716@.TK2MSFTNGP05.phx.gbl...
>
No I can't find it. Any clues where abouts I might find it. I have looked on
the properties on of the dataset etc.
"KJ" <n_o_s_p_a__M@.Mail.com> wrote in message
news:OFjUR$GoHHA.716@.TK2MSFTNGP05.phx.gbl...
> Is there a setting for the database "Schema Name" somewhere on the
> properties of the data set? That's what's being prepended to the table
> name.
> "Chris" <nospam@.nospam.com> wrote in message
> news:OdiLaBGoHHA.4412@.TK2MSFTNGP02.phx.gbl...
>
Sorry I must be missing something. When you say "check for default schema",
I can't find it it. It is SQL 2005. I have gone to the login propeties page
of the login (in SQL 2005), gone to user mapping and put the default scheme
over to do_owner but the sql scripts generated are still this same in VS
2005
"KJ" <n_o_s_p_a__M@.Mail.com> wrote in message
news:O7IrnYJoHHA.1476@.TK2MSFTNGP03.phx.gbl...
> Which version of SQL Server? If 2005, go to the properties page of the
> login you are using (via Management Studio), and check the value for
> Default Schema for that login. My guess is that it's not dbo. But this is
> just a guess.
> "Chris" <nospam@.nospam.com> wrote in message
> news:OxkTYdHoHHA.4124@.TK2MSFTNGP02.phx.gbl...
>
"db_owner" is a role, not a schema; "dbo" is a schema.
When you look at the name of the table in the Object Explorer (of Management
Studio), what is it? Is it dbo.TableName, or WebManagerV2.TableName?
"Chris" <nospam@.nospam.com> wrote in message
news:O7PiG6KoHHA.5052@.TK2MSFTNGP04.phx.gbl...
> Sorry I must be missing something. When you say "check for default
> schema", I can't find it it. It is SQL 2005. I have gone to the login
> propeties page of the login (in SQL 2005), gone to user mapping and put
> the default scheme over to do_owner but the sql scripts generated are
> still this same in VS 2005
>
> "KJ" <n_o_s_p_a__M@.Mail.com> wrote in message
> news:O7IrnYJoHHA.1476@.TK2MSFTNGP03.phx.gbl...
>
http://Pamela-Anderson-in-nylons.in...p?movie=1673286

Strongly typed dataset

I have started using strongly typed datasets as the basis of my data access
layer. They work well but can be a bit fiddly when adding columns. I have a
column which refuses to "change". It is an integer which when I change its
value in the datatable it changes from 1 to 2 (I can see it in the
debugger). When I call the update method it resets back to 1.
Does anyone have any ideas. I don't want to recreate my DAL object without
knowing what I have done wrong. Ideally I would like to just recreate all my
stored procedures but doing that seems to "append columns" to the dataset in
the design view.
If I add some columns to my database what is the best way of regenerating
all the stored procedure and the column names for the strongly typed
dataset.
Regards, Chris."Chris" <nospam@.nospam.com> wrote in message
news:ulPXy7LnHHA.4120@.TK2MSFTNGP06.phx.gbl...
>I have started using strongly typed datasets as the basis of my data access
>layer. They work well but can be a bit fiddly when adding columns. I have a
>column which refuses to "change". It is an integer which when I change its
>value in the datatable it changes from 1 to 2 (I can see it in the
>debugger). When I call the update method it resets back to 1.
> Does anyone have any ideas. I don't want to recreate my DAL object without
> knowing what I have done wrong. Ideally I would like to just recreate all
> my stored procedures but doing that seems to "append columns" to the
> dataset in the design view.
> If I add some columns to my database what is the best way of regenerating
> all the stored procedure and the column names for the strongly typed
> dataset.
I don't know the answer to your problem, but here's a hint: DataSets don't
write to the database. Look at the parts that do. You may find, for
instance, that it isn't that the column is being reset to 1, but that it
isn't being set to 2.
--
John Saunders [MVP]

Strongly typed dataset

I have started using strongly typed datasets as the basis of my data access
layer. They work well but can be a bit fiddly when adding columns. I have a
column which refuses to "change". It is an integer which when I change its
value in the datatable it changes from 1 to 2 (I can see it in the
debugger). When I call the update method it resets back to 1.

Does anyone have any ideas. I don't want to recreate my DAL object without
knowing what I have done wrong. Ideally I would like to just recreate all my
stored procedures but doing that seems to "append columns" to the dataset in
the design view.

If I add some columns to my database what is the best way of regenerating
all the stored procedure and the column names for the strongly typed
dataset.

Regards, Chris."Chris" <nospam@.nospam.comwrote in message
news:ulPXy7LnHHA.4120@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

>I have started using strongly typed datasets as the basis of my data access
>layer. They work well but can be a bit fiddly when adding columns. I have a
>column which refuses to "change". It is an integer which when I change its
>value in the datatable it changes from 1 to 2 (I can see it in the
>debugger). When I call the update method it resets back to 1.
>
Does anyone have any ideas. I don't want to recreate my DAL object without
knowing what I have done wrong. Ideally I would like to just recreate all
my stored procedures but doing that seems to "append columns" to the
dataset in the design view.
>
If I add some columns to my database what is the best way of regenerating
all the stored procedure and the column names for the strongly typed
dataset.


I don't know the answer to your problem, but here's a hint: DataSets don't
write to the database. Look at the parts that do. You may find, for
instance, that it isn't that the column is being reset to 1, but that it
isn't being set to 2.
--
John Saunders [MVP]

Strongly typed datasets and nested repeaters

I have a strongly typed dataset that returns two tables - "items" and
"itemdetails". In the strongly-typed dataset designer, I've created a link
(relationship) between the two tables based on a foreign key.

I want to put them into a nested repeater, but I'm having problems finding a
"nice" way of doing it.

Can someone please point me in the direction of a tutorial or best practice
to achieve this?

Thanks in advance,

Duncanassign the "Items" table to the outter repeater, then in the
OnItemDataBound event handler:

switch (e.Item.ItemType){
case ListItemType.Item: case ListItemType.AlternatingItem:
Repeater ir = e.Item.FindControl("rptInnerRepeater")
ir.DataSource =
((DataRowView)e.Item.DataItem).CreateChildView("ItemDetailDataRelation");
ir.DataBind();
}

hope that helps
Thanks for your reply; I saw this example on the web, but I'm unsure where
the ItemDetailDataRelation comes from. I tried all the relationship names
that were in the strongly-typed dataset designer, but they gave an error.

I got the impression that if you were doing it between two datatables, that
would be the name of the Relations.Add(... but I couldn't seem to create a
programatic relationship between two fields in a strongly typed dataset.

Duncan

"bfking" <bfking@.gmail.com> wrote in message
news:1112879887.227421.298170@.g14g2000cwa.googlegr oups.com...
> assign the "Items" table to the outter repeater, then in the
> OnItemDataBound event handler:
> switch (e.Item.ItemType){
> case ListItemType.Item: case ListItemType.AlternatingItem:
> Repeater ir = e.Item.FindControl("rptInnerRepeater")
> ir.DataSource =
> ((DataRowView)e.Item.DataItem).CreateChildView("ItemDetailDataRelation");
> ir.DataBind();
> }
> hope that helps
The relation is set up in the dataset.

something like
_myDataSet.Relations.Add("Users_Results", _myDataSet.TableA.UsersNameColumn,
_myDataSet.TableB.UsersNameColumn);

where _myDataSet is your strongly typed DataSet.
in your nested Repeater you would then do something like this:

<asp:repeater id="_reportoutput" Runat="server"
...templates

//nested repeater
<asp:repeater id="_nextstuff" Runat="server" DataSource='<%#
GetChildRelation(Container.DataItem,"Users_Results")%>'
with the following in your code behind:

public static DataView GetChildRelation(object dataItem, string relation)
{
DataRowView drv = dataItem as DataRowView;
if (drv != null)

return drv.CreateChildView(relation);
else
return null;
}

MattC
"Duncan Welch" <dunc@.ntpcl.f9.co.uk> wrote in message
news:usyUFl3OFHA.984@.TK2MSFTNGP10.phx.gbl...
> Thanks for your reply; I saw this example on the web, but I'm unsure where
> the ItemDetailDataRelation comes from. I tried all the relationship names
> that were in the strongly-typed dataset designer, but they gave an error.
> I got the impression that if you were doing it between two datatables,
> that
> would be the name of the Relations.Add(... but I couldn't seem to create a
> programatic relationship between two fields in a strongly typed dataset.
> Duncan
> "bfking" <bfking@.gmail.com> wrote in message
> news:1112879887.227421.298170@.g14g2000cwa.googlegr oups.com...
>> assign the "Items" table to the outter repeater, then in the
>> OnItemDataBound event handler:
>>
>> switch (e.Item.ItemType){
>> case ListItemType.Item: case ListItemType.AlternatingItem:
>> Repeater ir = e.Item.FindControl("rptInnerRepeater")
>> ir.DataSource =
>> ((DataRowView)e.Item.DataItem).CreateChildView("ItemDetailDataRelation");
>> ir.DataBind();
>> }
>>
>> hope that helps
>>

Strongly typed datasets and nested repeaters

I have a strongly typed dataset that returns two tables - "items" and
"itemdetails". In the strongly-typed dataset designer, I've created a link
(relationship) between the two tables based on a foreign key.
I want to put them into a nested repeater, but I'm having problems finding a
"nice" way of doing it.
Can someone please point me in the direction of a tutorial or best practice
to achieve this?
Thanks in advance,
Duncanassign the "Items" table to the outter repeater, then in the
OnItemDataBound event handler:
switch (e.Item.ItemType){
case ListItemType.Item: case ListItemType.AlternatingItem:
Repeater ir = e.Item.FindControl("rptInnerRepeater")
ir.DataSource =
((DataRowView)e.Item.DataItem).CreateChildView("ItemDetailDataRelation");
ir.DataBind();
}
hope that helps
Thanks for your reply; I saw this example on the web, but I'm unsure where
the ItemDetailDataRelation comes from. I tried all the relationship names
that were in the strongly-typed dataset designer, but they gave an error.
I got the impression that if you were doing it between two datatables, that
would be the name of the Relations.Add(... but I couldn't seem to create a
programatic relationship between two fields in a strongly typed dataset.
Duncan
"bfking" <bfking@.gmail.com> wrote in message
news:1112879887.227421.298170@.g14g2000cwa.googlegroups.com...
> assign the "Items" table to the outter repeater, then in the
> OnItemDataBound event handler:
> switch (e.Item.ItemType){
> case ListItemType.Item: case ListItemType.AlternatingItem:
> Repeater ir = e.Item.FindControl("rptInnerRepeater")
> ir.DataSource =
> ((DataRowView)e.Item.DataItem).CreateChildView("ItemDetailDataRelation");
> ir.DataBind();
> }
> hope that helps
>
The relation is set up in the dataset.
something like
_myDataSet.Relations.Add("Users_Results", _myDataSet.TableA.UsersNameColumn,
_myDataSet.TableB.UsersNameColumn);
where _myDataSet is your strongly typed DataSet.
in your nested Repeater you would then do something like this:
<asp:repeater id="_reportoutput" Runat="server">
...templates
//nested repeater
<asp:repeater id="_nextstuff" Runat="server" DataSource='<%#
GetChildRelation(Container.DataItem,"Users_Results")%>'>
with the following in your code behind:
public static DataView GetChildRelation(object dataItem, string relation)
{
DataRowView drv = dataItem as DataRowView;
if (drv != null)
return drv.CreateChildView(relation);
else
return null;
}
MattC
"Duncan Welch" <dunc@.ntpcl.f9.co.uk> wrote in message
news:usyUFl3OFHA.984@.TK2MSFTNGP10.phx.gbl...
> Thanks for your reply; I saw this example on the web, but I'm unsure where
> the ItemDetailDataRelation comes from. I tried all the relationship names
> that were in the strongly-typed dataset designer, but they gave an error.
> I got the impression that if you were doing it between two datatables,
> that
> would be the name of the Relations.Add(... but I couldn't seem to create a
> programatic relationship between two fields in a strongly typed dataset.
> Duncan
> "bfking" <bfking@.gmail.com> wrote in message
> news:1112879887.227421.298170@.g14g2000cwa.googlegroups.com...
>

Strongly typed datasets and XML

I am having trouble understanding strongly typed datasets and XML files. I
have the following schema:

<xs:schema id="Pages" targetNamespace="http://asdf.org/EOBEPages.xsd"
elementFormDefault="qualified"
xmlns="http://asdf.org" xmlns:mstns="http://asdf.org/EOBEPages.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="EOBEPages">
<xs:complexType>
<xs:sequence>
<xs:element name="Page">
<xs:complexType>
<xs:sequence>
<xs:element name="PageTitle" type="xs:string" />
<xs:element name="PageText" type="xs:string" />
<xs:element name="PageNumber" type="xs:integer" />
<xs:element name="NumImages" type="xs:integer" />
<xs:element name="ImagesDescription" type="xs:string" minOccurs="0"
maxOccurs="1" />
<xs:element name="ImageDefinitions">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema
I load the xml data into the dataset no problem, and can access the "page"
info by:

myDataset.Page(index).pageTitle

, etc, but can NOT access the "ImageDefinitions", because I guess I don't
understand how. What I wanted to do is something like:

myVar = myDataset.Page(index).ImageDefinitions(index2).Des cription

but this is not part of the dataset... why? How can I get access to the
image definition descriptions based on the page index?

Thanks a bunch!

MC Ddatasets are tables with relationships. every xml complex type becomes a new
table. ImageDefinitions becomes a table which you can access.

myVar = myDataset.ImageDefinitions(index).Description

if you have a relionship setup you can access ImageDefinitions rows from
Page rows using GetChildRows

-- bruce (sqlwork.com)

"Big D" <a@.a.com> wrote in message
news:uam6WMY9DHA.1632@.TK2MSFTNGP12.phx.gbl...
> I am having trouble understanding strongly typed datasets and XML files.
I
> have the following schema:
> <xs:schema id="Pages" targetNamespace="http://asdf.org/EOBEPages.xsd"
> elementFormDefault="qualified"
> xmlns="http://asdf.org" xmlns:mstns="http://asdf.org/EOBEPages.xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="EOBEPages">
> <xs:complexType>
> <xs:sequence
> <xs:element name="Page">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="PageTitle" type="xs:string" />
> <xs:element name="PageText" type="xs:string" />
> <xs:element name="PageNumber" type="xs:integer" />
> <xs:element name="NumImages" type="xs:integer" />
> <xs:element name="ImagesDescription" type="xs:string" minOccurs="0"
> maxOccurs="1" /
> <xs:element name="ImageDefinitions">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Description" type="xs:string" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> I load the xml data into the dataset no problem, and can access the "page"
> info by:
> myDataset.Page(index).pageTitle
> , etc, but can NOT access the "ImageDefinitions", because I guess I don't
> understand how. What I wanted to do is something like:
> myVar = myDataset.Page(index).ImageDefinitions(index2).Des cription
> but this is not part of the dataset... why? How can I get access to the
> image definition descriptions based on the page index?
> Thanks a bunch!
> MC D

Strongly-typed Datasets in ASP.NET 2.0

Hello,

In ASP.NET 1.1, I followed this data access methodology:

At design time
- Create a strongly typed dataset
- Add this dataset to a form and bind controls to the dataset using
the designer

At run time
- Fill dataset with data on the first load of the page
- Handle all Add/Edit/Delete operations against the in-memory copy
of my dataset
- Persist the dataset between postbacks in session
- Give users the ability to Save or Cancel changes, which either
persists the changes to the database or discards them.

It worked like a charm -- there were only two trips to the database --
in the very beginning and at the very end. In memory manipulations were
very fast. And, more importantly, my productivity was high because I
was able to use design features of the Visual Studio.

It seems that in 2005, if I were to pursue the same methodology, things
would be harder, not easier.

- It appears that the only way to bind a dataset to a gridview is
through the ObjectDataSource. This binds to table adapters, not the
actual dataset, so, the database gets hit on each update.

- DataSource property is gone from the design view, so I no longer can
use the design features of Visual Studio, if I were to directly bind to
a dataset.

- There is no out of the box feature to persist a dataset between
postbacks. So, like in 1.1, if I were to go this route, I would have to
persist it in session.

I was wondering if there is anybody out there who used the 1.1 data
access in a similar fashion, and how you adapted to 2.0.

Thank you for your comments.

Evgueni

Hi Evgueni,

You can create a strongly typed DS without table adapters also. Simplest way is to just open the DS in the designer and delete the adapter part. You can then use this DS to bind to a gridView (like in 1.1) but you need to manually write code to add rows to it. Alternatively, you can use an ObjectDatasource and let it handle the DB code itself.

HTH,

Vivek


Wouldn't that be great, if there was a data source object that would out of the box:

- bind directly to a dataset, not table adapters
- know how to persist the dataset between postbacks (maybe different persistence models such as session or cache)
- have the load and update methods to interact with the database

Basically, Windows Forms pattern -- but in a stateless environment. This would greatly assist us with creating cancellable forms such as wizard and complex master/child forms.

Am I talking non-sense, or is it something that people could use in ASP.NET?


Data source controls controls can either directly connect to a data store such as a DB or XML files, or to a business object (such as a strongly typed dataset). They act like a "broker" dealing with the manipulation of data so that the developer is spared of writing too much standard data access code. So an object data source can bind directly to a dataset (and you need to create a strongly typed dataset for it, or a custom business object) and also support caching. When using typed datasets, the VS 2005 designer creates TableAdapters for the Datasets, which is an advanced and quite useful feature considering the fact that TableAdapters extend DataAdpaters.

Now when we talk about binding directly to a dataset, this we can easily do, but tableAdapeters help us to avoid writing CRUD code (with the help of VS designer) and save time. You can very easily attach Load and Update methods using TableAdapter to bind to a particular table in the DB. So my point is that TableAdapters are just some "nitro boosted" form of DataAdapters, and while using them you are infact binding with the typed Datasets only.

Summarising, all your requirements can be easily met with the new ADO.NET and VS 2005 designer features in .NET 2.0.

Let me know if you need more details.

Vivek


Vivek, thank you for your response.

I understand that what I am asking for can be done in .NET 2.0. My point is that you actually have to write code if you want to bind directly to a dataset, and I don't want to do thatSmile. For example, I want to bind directly to the dataset, and maintain a full design-time experience like I had in 2003. I can't do that now because the Data Source property is not available in the designer. Am I missing something here?

Evgueni


Evgueni,

You can use the DataSource property for the GridView in the code behind, but the reason it is not there in the Properties window is due to the fact that if we bind a gridview to a non-datasourcecontrol object, we need to provide custom paging. So it is advisable to use an ObjectDataSource which is connected to a strongly typed dataset with a gridview. All relevant designer properties would be supported.

Let me know if you still face issues with this approach.

Vivek

StronglyTyped DataSets in ASP.NET 2.0

Hi all gurus.
I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app
heavily relying on StronglyTyped DataSets, with lots of FindByKey...,
dataSet.Tablename, and similar methods. Converting to ASP.NET 2.0
leaves dataSets' classes unconverted, as stated by M$; what's worse,
I'm not able to use converted dataSets, nor new ones, but just non-
typed dataSets declared directly in pages (or code-behind), and so I'm
not allowed to use a lot of methods and tables tied to dataSets. As a
cherry on the pie, DataSets are greyed in all-view Tools (and not
visible without all-view).
Is it a standard behaviour or there's something messed up in my VS
2005?
AFAIK, M$ declares that previous data objects are still at the basis
of the new data model, and in my situation?On 7 Giu, 09:34, "S.Tedeschi" <t...@.tesis.org> wrote:
> Hi all gurus.
> I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app
> heavily relying on StronglyTyped DataSets, with lots of FindByKey...,dataS
et.Tablename, and similar methods. Converting to ASP.NET 2.0
> leaves dataSets' classes unconverted, as stated by M$; what's worse,
> I'm not able to use converted dataSets, nor new ones, but just non-
> typed dataSets declared directly in pages (or code-behind), and so I'm
> not allowed to use a lot of methods and tables tied to dataSets. As a
> cherry on the pie, DataSets are greyed in all-view Tools (and not
> visible without all-view).
> Is it a standard behaviour or there's something messed up in my VS
> 2005?
> AFAIK, M$ declares that previous data objects are still at the basis
> of the new data model, and in my situation?
A little sharpening: actually, a can drop a dataSet into "Component
Designer", but I can't find any DataSet class. I guess VS2005 is no
more able to auto-generate classes from a DataSet, a normal operation
for VS2003.
Is still DataSet model a good way for ops or should I swith to
TableAdapers-only environment?
Ysgrifennodd S.Tedeschi:
> Hi all gurus.
> I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app
> heavily relying on StronglyTyped DataSets, with lots of FindByKey...,
> dataSet.Tablename, and similar methods. Converting to ASP.NET 2.0
> leaves dataSets' classes unconverted, as stated by M$; what's worse,
> I'm not able to use converted dataSets, nor new ones, but just non-
> typed dataSets declared directly in pages (or code-behind), and so I'm
> not allowed to use a lot of methods and tables tied to dataSets. As a
> cherry on the pie, DataSets are greyed in all-view Tools (and not
> visible without all-view).
> Is it a standard behaviour or there's something messed up in my VS
> 2005?
> AFAIK, M$ declares that previous data objects are still at the basis
> of the new data model, and in my situation?
>
Strongly typed DataSets are much changed - and, in my opinion, much
improved - in .NET 2.0. I've never tried to convert, so it may be that
you have to do so by hand. If you do, it might be a nuisance, but it
shouldn't take long and will, at least, get you up to speed on .NET 2.0
DataSets.
If it would help, I have some documentation I did for our developers at
work along with a sample application, which I'd be happy to let you
have. Just contact me off-list at
p[dot]bradley[at]dsl[dot]pipex[dot]com, and I'll send it to you.
Cheers
Peter

StronglyTyped DataSets in ASP.NET 2.0

Hi all gurus.
I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app
heavily relying on StronglyTyped DataSets, with lots of FindByKey...,
dataSet.Tablename, and similar methods. Converting to ASP.NET 2.0
leaves dataSets' classes unconverted, as stated by M$; what's worse,
I'm not able to use converted dataSets, nor new ones, but just non-
typed dataSets declared directly in pages (or code-behind), and so I'm
not allowed to use a lot of methods and tables tied to dataSets. As a
cherry on the pie, DataSets are greyed in all-view Tools (and not
visible without all-view).
Is it a standard behaviour or there's something messed up in my VS
2005?
AFAIK, M$ declares that previous data objects are still at the basis
of the new data model, and in my situation?On 7 Giu, 09:34, "S.Tedeschi" <t...@.tesis.orgwrote:

Quote:

Originally Posted by

Hi all gurus.
I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app
heavily relying on StronglyTyped DataSets, with lots of FindByKey...,dataSet.Tablename, and similar methods. Converting to ASP.NET 2.0
leaves dataSets' classes unconverted, as stated by M$; what's worse,
I'm not able to use converted dataSets, nor new ones, but just non-
typed dataSets declared directly in pages (or code-behind), and so I'm
not allowed to use a lot of methods and tables tied to dataSets. As a
cherry on the pie, DataSets are greyed in all-view Tools (and not
visible without all-view).
Is it a standard behaviour or there's something messed up in my VS
2005?
AFAIK, M$ declares that previous data objects are still at the basis
of the new data model, and in my situation?


A little sharpening: actually, a can drop a dataSet into "Component
Designer", but I can't find any DataSet class. I guess VS2005 is no
more able to auto-generate classes from a DataSet, a normal operation
for VS2003.
Is still DataSet model a good way for ops or should I swith to
TableAdapers-only environment?
Ysgrifennodd S.Tedeschi:

Quote:

Originally Posted by

Hi all gurus.
I'm trying to switch to VS 2005, from VS 2003. I've an ASP.NET 1.1 app
heavily relying on StronglyTyped DataSets, with lots of FindByKey...,
dataSet.Tablename, and similar methods. Converting to ASP.NET 2.0
leaves dataSets' classes unconverted, as stated by M$; what's worse,
I'm not able to use converted dataSets, nor new ones, but just non-
typed dataSets declared directly in pages (or code-behind), and so I'm
not allowed to use a lot of methods and tables tied to dataSets. As a
cherry on the pie, DataSets are greyed in all-view Tools (and not
visible without all-view).
Is it a standard behaviour or there's something messed up in my VS
2005?
AFAIK, M$ declares that previous data objects are still at the basis
of the new data model, and in my situation?
>


Strongly typed DataSets are much changed - and, in my opinion, much
improved - in .NET 2.0. I've never tried to convert, so it may be that
you have to do so by hand. If you do, it might be a nuisance, but it
shouldn't take long and will, at least, get you up to speed on .NET 2.0
DataSets.

If it would help, I have some documentation I did for our developers at
work along with a sample application, which I'd be happy to let you
have. Just contact me off-list at
p[dot]bradley[at]dsl[dot]pipex[dot]com, and I'll send it to you.

Cheers

Peter