2.0 DataSources vs. TableAdapter/Datasets

G

GaryDean

We have been noticing that questions on vs.2005/2.0 don't appear to get much
in answers so I'm reposting some questions posted by some of the programmers
here in our organization that never got answered...

There are articles on the new TableAdapters where it says that a key new
advantage is that a single TableAdapter, which can have multiple queries,
can be used on multiple forms. Now that was in an article on using
TableAdapters with Forms Apps. There is a DataSource window that stores
common datasources for the whole project (accessed via the Data menu item).

Now, back to ASP apps - there is no Data on the menu, no datasource window,
and it looks like TableAdapters need to be generated from a DataSource
dropped on a page. Does this mean that aspx pages won't be able to share
TableAdapters?

Also, in Form apps the IDE guids us to create the new 2.0 .XSD datasets that
have TableAdapters where the ASP IDE guids us to create DataSources that
don't create .XSDs with TableAdapters. Why the difference?
 
S

Steven Cheng[MSFT]

Hi Gary,

Welcome.
As for the TableAdapter's different design mode and behavior in .net 2.0
winform app and asp.net application ,here are some of my understanding and
suggestions:

For the different design-time support and behavior on using TableAdpater
components in winform application and asp.net application, it is due to the
different underlying application nature and programming model. Winform
application is desktop app where all the class instances and componets live
in the application's memorty space as long as the application keep alive...
While for asp.net application, it is request/response based, asp.net page
instance only live when a request arrive server and being processed, after
request finished, the page object will disposed(also, mulitple page
instances won't have relations to each other.... ) , so we should not use
the same programming model as winform app.

For sharing component instance or class objects in asp.net application, we
can use the following means:

1. Create the shared component instance and store it in a global wide
storage, e.g the ApplicationState or Application Cache is the reasonable
place for storing such component....

2. Also, if your applcation always running in a single appdomain, you can
consider using a certain class's public static member property to hold such
shared data or resources so that all the pages requests can reference those
shared objects....

In addition, ASP.NET appliation in VS.NET can help us create typed dataset
and a TableAdapter through design surface, however, as I mentioned, due to
the different programming model, ASP.NET will have limited support on using
TableAdpater as winform application at design-time.... but since
TableAdapter has encapsulated most code, we can just declare certain
vartiables and create the instance to use them.....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)





--------------------
| From: "GaryDean" <[email protected]>
| Subject: 2.0 DataSources vs. TableAdapter/Datasets
| Date: Sat, 31 Dec 2005 14:29:31 -0800
| Lines: 25
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: user-vcaur7q.dsl.mindspring.com 216.175.108.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:367882
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| We have been noticing that questions on vs.2005/2.0 don't appear to get
much
| in answers so I'm reposting some questions posted by some of the
programmers
| here in our organization that never got answered...
|
| There are articles on the new TableAdapters where it says that a key new
| advantage is that a single TableAdapter, which can have multiple queries,
| can be used on multiple forms. Now that was in an article on using
| TableAdapters with Forms Apps. There is a DataSource window that stores
| common datasources for the whole project (accessed via the Data menu
item).
|
| Now, back to ASP apps - there is no Data on the menu, no datasource
window,
| and it looks like TableAdapters need to be generated from a DataSource
| dropped on a page. Does this mean that aspx pages won't be able to share
| TableAdapters?
|
| Also, in Form apps the IDE guids us to create the new 2.0 .XSD datasets
that
| have TableAdapters where the ASP IDE guids us to create DataSources that
| don't create .XSDs with TableAdapters. Why the difference?
|
|
| --
| Regards,
| Gary Blakely
|
|
|
 
G

GaryDean

Steven,
Please tell me if this is correct...

I can create a .xsd and TableAdapter for an ASP app in design time. However
vs.net 2005 does not allow me to connect that .xsd to my GridView at design
time (as did vs 2003 allowed me to connect a .xsd to my DataGrid). So
because of this weakness I should do the following.....

Create a .xsd in my App_Code folder. Create a class in my App_Code folder
that returns this dataset. Call this class from my aspx pages.

Is this the best practice???

now, my rant....
It seems like vs2005 has taken us backwords. If we follow the MSDN articles
it has us creating DataSources for our gridviews that puts SQL in our ASPX
pages (and that is not acceptable). vs2005 has also taken away our ability
to bind to datasets at design time - WHY? do I misunderstand?
 
S

Steven Cheng[MSFT]

Thanks for your response Gary,

My answers in line:

I can create a .xsd and TableAdapter for an ASP app in design time.
However
vs.net 2005 does not allow me to connect that .xsd to my GridView at design
time (as did vs 2003 allowed me to connect a .xsd to my DataGrid). So
because of this weakness I should do the following.....

Create a .xsd in my App_Code folder. Create a class in my App_Code folder
that returns this dataset. Call this class from my aspx pages.

Is this the best practice???
=============================================
Of course we can connect the created TableAdapter/ typed Dataset to the
DataBound control at design-time, just use the ObjectDatasource control,
and the steps to do this is:

i) create the DataSet/TableAdatper pairs through wizard....
ii)drag a ObjectDataSource control onto the page want to use that
TableAdapter/DataSet to retrieve data....
iii) configure the ObjectDataSource control to use the TableAdapter as the
component class
iv) connect the databoundcontrol(gridview, detailsview...) to the
objectdatasource...

Here is the quickstart example which contains bind a tableadapter/dataset
to asp.net databound control at design-time...:

#ObjectDataSource
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/data/objectdatasource.aspx




now, my rant....
It seems like vs2005 has taken us backwords. If we follow the MSDN
articles
it has us creating DataSources for our gridviews that puts SQL in our ASPX
pages (and that is not acceptable). vs2005 has also taken away our ability
to bind to datasets at design time - WHY? do I misunderstand?
==============================================
And the VS2003's approch is actually based on some autogenerated code
(inside the initializeComponents function...), this is sometimes a bit hard
to maintain since it is IDE autogenerated.... While vs 2005 use the new
datasource control model which avoid much IDE generated code.... Just put
datasource control at configure it in page template statically (no much
code needed....)

Also, though SQLDataSource control need to specify sql statement in aspx
template, you can choose to precompiled page so that no aspx content will
be exposed at deployment time... Also, sqldatasource provide a rapid data
access developing approach which is suitable for some simple application or
design prototype.... ObjectDataSource provide the more flexible and
advanced means to connect to different data access layer....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)











--------------------
| From: "GaryDean" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| Date: Tue, 3 Jan 2006 10:25:25 -0800
| Lines: 135
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: user-vcauk40.dsl.mindspring.com 216.175.80.128
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:368327
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steven,
| Please tell me if this is correct...
|
| I can create a .xsd and TableAdapter for an ASP app in design time.
However
| vs.net 2005 does not allow me to connect that .xsd to my GridView at
design
| time (as did vs 2003 allowed me to connect a .xsd to my DataGrid). So
| because of this weakness I should do the following.....
|
| Create a .xsd in my App_Code folder. Create a class in my App_Code
folder
| that returns this dataset. Call this class from my aspx pages.
|
| Is this the best practice???
|
| now, my rant....
| It seems like vs2005 has taken us backwords. If we follow the MSDN
articles
| it has us creating DataSources for our gridviews that puts SQL in our
ASPX
| pages (and that is not acceptable). vs2005 has also taken away our
ability
| to bind to datasets at design time - WHY? do I misunderstand?
|
| --
| Regards,
| Gary Blakely
| | > Hi Gary,
| >
| > Welcome.
| > As for the TableAdapter's different design mode and behavior in .net 2.0
| > winform app and asp.net application ,here are some of my understanding
and
| > suggestions:
| >
| > For the different design-time support and behavior on using
TableAdpater
| > components in winform application and asp.net application, it is due to
| > the
| > different underlying application nature and programming model. Winform
| > application is desktop app where all the class instances and componets
| > live
| > in the application's memorty space as long as the application keep
| > alive...
| > While for asp.net application, it is request/response based, asp.net
page
| > instance only live when a request arrive server and being processed,
after
| > request finished, the page object will disposed(also, mulitple page
| > instances won't have relations to each other.... ) , so we should not
use
| > the same programming model as winform app.
| >
| > For sharing component instance or class objects in asp.net application,
we
| > can use the following means:
| >
| > 1. Create the shared component instance and store it in a global wide
| > storage, e.g the ApplicationState or Application Cache is the reasonable
| > place for storing such component....
| >
| > 2. Also, if your applcation always running in a single appdomain, you
can
| > consider using a certain class's public static member property to hold
| > such
| > shared data or resources so that all the pages requests can reference
| > those
| > shared objects....
| >
| > In addition, ASP.NET appliation in VS.NET can help us create typed
| > dataset
| > and a TableAdapter through design surface, however, as I mentioned, due
to
| > the different programming model, ASP.NET will have limited support on
| > using
| > TableAdpater as winform application at design-time.... but since
| > TableAdapter has encapsulated most code, we can just declare certain
| > vartiables and create the instance to use them.....
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| > --------------------
| > | From: "GaryDean" <[email protected]>
| > | Subject: 2.0 DataSources vs. TableAdapter/Datasets
| > | Date: Sat, 31 Dec 2005 14:29:31 -0800
| > | Lines: 25
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: user-vcaur7q.dsl.mindspring.com 216.175.108.250
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:367882
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | We have been noticing that questions on vs.2005/2.0 don't appear to
get
| > much
| > | in answers so I'm reposting some questions posted by some of the
| > programmers
| > | here in our organization that never got answered...
| > |
| > | There are articles on the new TableAdapters where it says that a key
new
| > | advantage is that a single TableAdapter, which can have multiple
| > queries,
| > | can be used on multiple forms. Now that was in an article on using
| > | TableAdapters with Forms Apps. There is a DataSource window that
stores
| > | common datasources for the whole project (accessed via the Data menu
| > item).
| > |
| > | Now, back to ASP apps - there is no Data on the menu, no datasource
| > window,
| > | and it looks like TableAdapters need to be generated from a DataSource
| > | dropped on a page. Does this mean that aspx pages won't be able to
| > share
| > | TableAdapters?
| > |
| > | Also, in Form apps the IDE guids us to create the new 2.0 .XSD
datasets
| > that
| > | have TableAdapters where the ASP IDE guids us to create DataSources
that
| > | don't create .XSDs with TableAdapters. Why the difference?
| > |
| > |
| > | --
| > | Regards,
| > | Gary Blakely
| > |
| > |
| > |
| >
|
|
|
 
G

GaryDean

Steven:
I read the article you provided the hyperlink to with great interest. After
spending hours pouring over the details in that article and reading the help
on ObjectDataSource.Typename property I cannot determine what to put into
the ObjectDataSource Typename property. These docs are soooo bad.

The article you pointed me to has
TypeName="DataSetTableAdapters.PhotosTableAdapter" in the typename property
but there is no information at all on what DataSetTableAdapters is -
nothing.

I have in my asp project Dataset1.xsd with a dataset named Orders and a
TableAdapter named OrdersTableAdapter with methods FillOrders and GetOrders.
None of these names can be used in the Page_Load event as they are all not
defined.

If you click on View Source in this article it is using
TypeName="DataComponentTableAdapters.AlbumsTableAdapter" which seems at odds
with the article.

The Help file for the Typename property shows
typename="Samples.AspNet.CS.EmployeeLogic" but offers no explainations of
where that came from or what that means. The help file says that the
TypeName property Gets or sets the name of the class that the
ObjectDataSource object represents.

So, I cannot figure out what to put in the typename property - I can't
figure out what the classname is.

What should I put in the TypeName property?

thanks,
Gary
 
S

Steven Cheng[MSFT]

Thanks for your followup Gary,

For TypeName, it just let us specify the Data Access Class's class name,
also, as for
==========
but there is no information at all on what DataSetTableAdapters is -
nothing.
==========

this is nothing related with ObjectDataSource or TableAdapter, it is just a
Namespace of the class(TableAdapter...). As we know, in .net framework, we
can group classes into a given namespace so as to avoid name clash with
other company or studio's component package....

So for the VS IDE generated TAbleAdapter/Dataset, they'll be assigned a
namespace, e.g:

the following objectdatasource use a TableAdapter which has the namespace
"DataSet1TableAdapters",

=======================
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" .........
SelectMethod="GetData"
TypeName="DataSet1TableAdapters.CategoriesTableAdapter"
..........>
======================

#namespace
http://msdn.microsoft.com/library/en-us/csref/html/vclrfnamespace.asp?frame=
true

Also, if you're using VS IDE, you can use the design-time smart Tag wizard
to list all the available data accessing components(include TableAdapters )
in this project...

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| From: "GaryDean" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| Date: Thu, 5 Jan 2006 18:10:27 -0800
| Lines: 310
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.244.8.41
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:368939
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steven:
| I read the article you provided the hyperlink to with great interest.
After
| spending hours pouring over the details in that article and reading the
help
| on ObjectDataSource.Typename property I cannot determine what to put into
| the ObjectDataSource Typename property. These docs are soooo bad.
|
| The article you pointed me to has
| TypeName="DataSetTableAdapters.PhotosTableAdapter" in the typename
property
| but there is no information at all on what DataSetTableAdapters is -
| nothing.
|
| I have in my asp project Dataset1.xsd with a dataset named Orders and a
| TableAdapter named OrdersTableAdapter with methods FillOrders and
GetOrders.
| None of these names can be used in the Page_Load event as they are all
not
| defined.
|
| If you click on View Source in this article it is using
| TypeName="DataComponentTableAdapters.AlbumsTableAdapter" which seems at
odds
| with the article.
|
| The Help file for the Typename property shows
| typename="Samples.AspNet.CS.EmployeeLogic" but offers no explainations of
| where that came from or what that means. The help file says that the
| TypeName property Gets or sets the name of the class that the
| ObjectDataSource object represents.
|
| So, I cannot figure out what to put in the typename property - I can't
| figure out what the classname is.
|
| What should I put in the TypeName property?
|
| thanks,
| Gary
|
|
|
|
|
| --
| Regards,
| Gary Blakely
| Dean Blakely & Associates
| www.deanblakely.com
| | > Thanks for your response Gary,
| >
| > My answers in line:
| >
| > I can create a .xsd and TableAdapter for an ASP app in design time.
| > However
| > vs.net 2005 does not allow me to connect that .xsd to my GridView at
| > design
| > time (as did vs 2003 allowed me to connect a .xsd to my DataGrid). So
| > because of this weakness I should do the following.....
| >
| > Create a .xsd in my App_Code folder. Create a class in my App_Code
folder
| > that returns this dataset. Call this class from my aspx pages.
| >
| > Is this the best practice???
| > =============================================
| > Of course we can connect the created TableAdapter/ typed Dataset to the
| > DataBound control at design-time, just use the ObjectDatasource control,
| > and the steps to do this is:
| >
| > i) create the DataSet/TableAdatper pairs through wizard....
| > ii)drag a ObjectDataSource control onto the page want to use that
| > TableAdapter/DataSet to retrieve data....
| > iii) configure the ObjectDataSource control to use the TableAdapter as
the
| > component class
| > iv) connect the databoundcontrol(gridview, detailsview...) to the
| > objectdatasource...
| >
| > Here is the quickstart example which contains bind a
tableadapter/dataset
| > to asp.net databound control at design-time...:
| >
| > #ObjectDataSource
| >
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/data/objectdatasource.aspx
| >
| >
| >
| >
| > now, my rant....
| > It seems like vs2005 has taken us backwords. If we follow the MSDN
| > articles
| > it has us creating DataSources for our gridviews that puts SQL in our
ASPX
| > pages (and that is not acceptable). vs2005 has also taken away our
| > ability
| > to bind to datasets at design time - WHY? do I misunderstand?
| > ==============================================
| > And the VS2003's approch is actually based on some autogenerated code
| > (inside the initializeComponents function...), this is sometimes a bit
| > hard
| > to maintain since it is IDE autogenerated.... While vs 2005 use the
new
| > datasource control model which avoid much IDE generated code.... Just
put
| > datasource control at configure it in page template statically (no much
| > code needed....)
| >
| > Also, though SQLDataSource control need to specify sql statement in aspx
| > template, you can choose to precompiled page so that no aspx content
will
| > be exposed at deployment time... Also, sqldatasource provide a rapid
data
| > access developing approach which is suitable for some simple
application
| > or
| > design prototype.... ObjectDataSource provide the more flexible and
| > advanced means to connect to different data access layer....
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| >
| >
| >
| >
| >
| > --------------------
| > | From: "GaryDean" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > | Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| > | Date: Tue, 3 Jan 2006 10:25:25 -0800
| > | Lines: 135
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: user-vcauk40.dsl.mindspring.com 216.175.80.128
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:368327
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Steven,
| > | Please tell me if this is correct...
| > |
| > | I can create a .xsd and TableAdapter for an ASP app in design time.
| > However
| > | vs.net 2005 does not allow me to connect that .xsd to my GridView at
| > design
| > | time (as did vs 2003 allowed me to connect a .xsd to my DataGrid). So
| > | because of this weakness I should do the following.....
| > |
| > | Create a .xsd in my App_Code folder. Create a class in my App_Code
| > folder
| > | that returns this dataset. Call this class from my aspx pages.
| > |
| > | Is this the best practice???
| > |
| > | now, my rant....
| > | It seems like vs2005 has taken us backwords. If we follow the MSDN
| > articles
| > | it has us creating DataSources for our gridviews that puts SQL in our
| > ASPX
| > | pages (and that is not acceptable). vs2005 has also taken away our
| > ability
| > | to bind to datasets at design time - WHY? do I misunderstand?
| > |
| > | --
| > | Regards,
| > | Gary Blakely
| > | | > | > Hi Gary,
| > | >
| > | > Welcome.
| > | > As for the TableAdapter's different design mode and behavior in
.net
| > 2.0
| > | > winform app and asp.net application ,here are some of my
understanding
| > and
| > | > suggestions:
| > | >
| > | > For the different design-time support and behavior on using
| > TableAdpater
| > | > components in winform application and asp.net application, it is
due
| > to
| > | > the
| > | > different underlying application nature and programming model.
Winform
| > | > application is desktop app where all the class instances and
componets
| > | > live
| > | > in the application's memorty space as long as the application keep
| > | > alive...
| > | > While for asp.net application, it is request/response based, asp.net
| > page
| > | > instance only live when a request arrive server and being processed,
| > after
| > | > request finished, the page object will disposed(also, mulitple page
| > | > instances won't have relations to each other.... ) , so we should
not
| > use
| > | > the same programming model as winform app.
| > | >
| > | > For sharing component instance or class objects in asp.net
| > application,
| > we
| > | > can use the following means:
| > | >
| > | > 1. Create the shared component instance and store it in a global
wide
| > | > storage, e.g the ApplicationState or Application Cache is the
| > reasonable
| > | > place for storing such component....
| > | >
| > | > 2. Also, if your applcation always running in a single appdomain,
you
| > can
| > | > consider using a certain class's public static member property to
hold
| > | > such
| > | > shared data or resources so that all the pages requests can
reference
| > | > those
| > | > shared objects....
| > | >
| > | > In addition, ASP.NET appliation in VS.NET can help us create typed
| > | > dataset
| > | > and a TableAdapter through design surface, however, as I mentioned,
| > due
| > to
| > | > the different programming model, ASP.NET will have limited support
on
| > | > using
| > | > TableAdpater as winform application at design-time.... but since
| > | > TableAdapter has encapsulated most code, we can just declare certain
| > | > vartiables and create the instance to use them.....
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: "GaryDean" <[email protected]>
| > | > | Subject: 2.0 DataSources vs. TableAdapter/Datasets
| > | > | Date: Sat, 31 Dec 2005 14:29:31 -0800
| > | > | Lines: 25
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: user-vcaur7q.dsl.mindspring.com 216.175.108.250
| > | > | Path:
| > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:367882
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | We have been noticing that questions on vs.2005/2.0 don't appear
to
| > get
| > | > much
| > | > | in answers so I'm reposting some questions posted by some of the
| > | > programmers
| > | > | here in our organization that never got answered...
| > | > |
| > | > | There are articles on the new TableAdapters where it says that a
key
| > new
| > | > | advantage is that a single TableAdapter, which can have multiple
| > | > queries,
| > | > | can be used on multiple forms. Now that was in an article on
using
| > | > | TableAdapters with Forms Apps. There is a DataSource window that
| > stores
| > | > | common datasources for the whole project (accessed via the Data
menu
| > | > item).
| > | > |
| > | > | Now, back to ASP apps - there is no Data on the menu, no
datasource
| > | > window,
| > | > | and it looks like TableAdapters need to be generated from a
| > DataSource
| > | > | dropped on a page. Does this mean that aspx pages won't be able
to
| > | > share
| > | > | TableAdapters?
| > | > |
| > | > | Also, in Form apps the IDE guids us to create the new 2.0 .XSD
| > datasets
| > | > that
| > | > | have TableAdapters where the ASP IDE guids us to create
DataSources
| > that
| > | > | don't create .XSDs with TableAdapters. Why the difference?
| > | > |
| > | > |
| > | > | --
| > | > | Regards,
| > | > | Gary Blakely
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
G

GaryDean

I'm having a hare time communicating my problem....

I know that I need to specify the Datasets Class name in the typename
property. My problem is that I can't find out where that class name is
specified! there is just a DataSet1.xsd and a DataSet1.xss file and neither
of those files have anything such as a class name.

How do I find the class name??????\

(in a forms app I created, I just had to double click the node of the .xsd
file and a datasetDesigner.vb file got generated but this does not work in
my asp app)

Still searching for that magical class name...
 
S

Steven Cheng[MSFT]

Hi Gary,

the xsd file in the App_Code folder is dynamically compiled into assembly
which contains the DataSet and TableAdapter classes, that's why you do not
find the designer.cs(vb) file as in winform project. To find the
TableAdapter class, just drag the ObjectDataSource and in the configuration
wizard, when you need to choose the Business Object, check the "show only
data components..."., the TableAdapter will appear in it...

Also, if you just want to view the generated TableAdapter classes , open
the "Class View" through View--->Class View menu item, then in the Class
view, you will find all the currently available classes in the project
which include the TableAdapter and DataSet ....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: "GaryDean" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| Date: Fri, 6 Jan 2006 17:33:01 -0800
| Lines: 454
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.244.8.41
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:369161
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I'm having a hare time communicating my problem....
|
| I know that I need to specify the Datasets Class name in the typename
| property. My problem is that I can't find out where that class name is
| specified! there is just a DataSet1.xsd and a DataSet1.xss file and
neither
| of those files have anything such as a class name.
|
| How do I find the class name??????\
|
| (in a forms app I created, I just had to double click the node of the
..xsd
| file and a datasetDesigner.vb file got generated but this does not work
in
| my asp app)
|
| Still searching for that magical class name...
| --
| Regards,
| Gary Blakely
| | > Thanks for your followup Gary,
| >
| > For TypeName, it just let us specify the Data Access Class's class name,
| > also, as for
| > ==========
| > but there is no information at all on what DataSetTableAdapters is -
| > nothing.
| > ==========
| >
| > this is nothing related with ObjectDataSource or TableAdapter, it is
just
| > a
| > Namespace of the class(TableAdapter...). As we know, in .net framework,
we
| > can group classes into a given namespace so as to avoid name clash with
| > other company or studio's component package....
| >
| > So for the VS IDE generated TAbleAdapter/Dataset, they'll be assigned a
| > namespace, e.g:
| >
| > the following objectdatasource use a TableAdapter which has the
namespace
| > "DataSet1TableAdapters",
| >
| > =======================
| > <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" .........
| > SelectMethod="GetData"
| > TypeName="DataSet1TableAdapters.CategoriesTableAdapter"
| > .........>
| > ======================
| >
| > #namespace
| >
http://msdn.microsoft.com/library/en-us/csref/html/vclrfnamespace.asp?frame=
| > true
| >
| > Also, if you're using VS IDE, you can use the design-time smart Tag
wizard
| > to list all the available data accessing components(include
| > TableAdapters )
| > in this project...
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | From: "GaryDean" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| > | Date: Thu, 5 Jan 2006 18:10:27 -0800
| > | Lines: 310
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 216.244.8.41
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:368939
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Steven:
| > | I read the article you provided the hyperlink to with great interest.
| > After
| > | spending hours pouring over the details in that article and reading
the
| > help
| > | on ObjectDataSource.Typename property I cannot determine what to put
| > into
| > | the ObjectDataSource Typename property. These docs are soooo bad.
| > |
| > | The article you pointed me to has
| > | TypeName="DataSetTableAdapters.PhotosTableAdapter" in the typename
| > property
| > | but there is no information at all on what DataSetTableAdapters is -
| > | nothing.
| > |
| > | I have in my asp project Dataset1.xsd with a dataset named Orders and
a
| > | TableAdapter named OrdersTableAdapter with methods FillOrders and
| > GetOrders.
| > | None of these names can be used in the Page_Load event as they are all
| > not
| > | defined.
| > |
| > | If you click on View Source in this article it is using
| > | TypeName="DataComponentTableAdapters.AlbumsTableAdapter" which seems
at
| > odds
| > | with the article.
| > |
| > | The Help file for the Typename property shows
| > | typename="Samples.AspNet.CS.EmployeeLogic" but offers no
explainations
| > of
| > | where that came from or what that means. The help file says that the
| > | TypeName property Gets or sets the name of the class that the
| > | ObjectDataSource object represents.
| > |
| > | So, I cannot figure out what to put in the typename property - I can't
| > | figure out what the classname is.
| > |
| > | What should I put in the TypeName property?
| > |
| > | thanks,
| > | Gary
| > |
| > |
| > |
| > |
| > |
| > | --
| > | Regards,
| > | Gary Blakely
| > | Dean Blakely & Associates
| > | www.deanblakely.com
| > | | > | > Thanks for your response Gary,
| > | >
| > | > My answers in line:
| > | >
| > | > I can create a .xsd and TableAdapter for an ASP app in design time.
| > | > However
| > | > vs.net 2005 does not allow me to connect that .xsd to my GridView at
| > | > design
| > | > time (as did vs 2003 allowed me to connect a .xsd to my DataGrid).
So
| > | > because of this weakness I should do the following.....
| > | >
| > | > Create a .xsd in my App_Code folder. Create a class in my App_Code
| > folder
| > | > that returns this dataset. Call this class from my aspx pages.
| > | >
| > | > Is this the best practice???
| > | > =============================================
| > | > Of course we can connect the created TableAdapter/ typed Dataset to
| > the
| > | > DataBound control at design-time, just use the ObjectDatasource
| > control,
| > | > and the steps to do this is:
| > | >
| > | > i) create the DataSet/TableAdatper pairs through wizard....
| > | > ii)drag a ObjectDataSource control onto the page want to use that
| > | > TableAdapter/DataSet to retrieve data....
| > | > iii) configure the ObjectDataSource control to use the TableAdapter
as
| > the
| > | > component class
| > | > iv) connect the databoundcontrol(gridview, detailsview...) to the
| > | > objectdatasource...
| > | >
| > | > Here is the quickstart example which contains bind a
| > tableadapter/dataset
| > | > to asp.net databound control at design-time...:
| > | >
| > | > #ObjectDataSource
| > | >
| >
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/data/objectdatasource.aspx
| > | >
| > | >
| > | >
| > | >
| > | > now, my rant....
| > | > It seems like vs2005 has taken us backwords. If we follow the MSDN
| > | > articles
| > | > it has us creating DataSources for our gridviews that puts SQL in
our
| > ASPX
| > | > pages (and that is not acceptable). vs2005 has also taken away our
| > | > ability
| > | > to bind to datasets at design time - WHY? do I misunderstand?
| > | > ==============================================
| > | > And the VS2003's approch is actually based on some autogenerated
code
| > | > (inside the initializeComponents function...), this is sometimes a
bit
| > | > hard
| > | > to maintain since it is IDE autogenerated.... While vs 2005 use
the
| > new
| > | > datasource control model which avoid much IDE generated code....
Just
| > put
| > | > datasource control at configure it in page template statically (no
| > much
| > | > code needed....)
| > | >
| > | > Also, though SQLDataSource control need to specify sql statement in
| > aspx
| > | > template, you can choose to precompiled page so that no aspx
content
| > will
| > | > be exposed at deployment time... Also, sqldatasource provide a
rapid
| > data
| > | > access developing approach which is suitable for some simple
| > application
| > | > or
| > | > design prototype.... ObjectDataSource provide the more flexible
and
| > | > advanced means to connect to different data access layer....
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | From: "GaryDean" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| > | > | Date: Tue, 3 Jan 2006 10:25:25 -0800
| > | > | Lines: 135
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: user-vcauk40.dsl.mindspring.com 216.175.80.128
| > | > | Path:
| > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:368327
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | Steven,
| > | > | Please tell me if this is correct...
| > | > |
| > | > | I can create a .xsd and TableAdapter for an ASP app in design
time.
| > | > However
| > | > | vs.net 2005 does not allow me to connect that .xsd to my GridView
at
| > | > design
| > | > | time (as did vs 2003 allowed me to connect a .xsd to my
DataGrid).
| > So
| > | > | because of this weakness I should do the following.....
| > | > |
| > | > | Create a .xsd in my App_Code folder. Create a class in my
App_Code
| > | > folder
| > | > | that returns this dataset. Call this class from my aspx pages.
| > | > |
| > | > | Is this the best practice???
| > | > |
| > | > | now, my rant....
| > | > | It seems like vs2005 has taken us backwords. If we follow the
MSDN
| > | > articles
| > | > | it has us creating DataSources for our gridviews that puts SQL in
| > our
| > | > ASPX
| > | > | pages (and that is not acceptable). vs2005 has also taken away
our
| > | > ability
| > | > | to bind to datasets at design time - WHY? do I misunderstand?
| > | > |
| > | > | --
| > | > | Regards,
| > | > | Gary Blakely
message
| > | > | | > | > | > Hi Gary,
| > | > | >
| > | > | > Welcome.
| > | > | > As for the TableAdapter's different design mode and behavior in
| > net
| > | > 2.0
| > | > | > winform app and asp.net application ,here are some of my
| > understanding
| > | > and
| > | > | > suggestions:
| > | > | >
| > | > | > For the different design-time support and behavior on using
| > | > TableAdpater
| > | > | > components in winform application and asp.net application, it is
| > due
| > | > to
| > | > | > the
| > | > | > different underlying application nature and programming model.
| > Winform
| > | > | > application is desktop app where all the class instances and
| > componets
| > | > | > live
| > | > | > in the application's memorty space as long as the application
keep
| > | > | > alive...
| > | > | > While for asp.net application, it is request/response based,
| > asp.net
| > | > page
| > | > | > instance only live when a request arrive server and being
| > processed,
| > | > after
| > | > | > request finished, the page object will disposed(also, mulitple
| > page
| > | > | > instances won't have relations to each other.... ) , so we
should
| > not
| > | > use
| > | > | > the same programming model as winform app.
| > | > | >
| > | > | > For sharing component instance or class objects in asp.net
| > | > application,
| > | > we
| > | > | > can use the following means:
| > | > | >
| > | > | > 1. Create the shared component instance and store it in a global
| > wide
| > | > | > storage, e.g the ApplicationState or Application Cache is the
| > | > reasonable
| > | > | > place for storing such component....
| > | > | >
| > | > | > 2. Also, if your applcation always running in a single
appdomain,
| > you
| > | > can
| > | > | > consider using a certain class's public static member property
to
| > hold
| > | > | > such
| > | > | > shared data or resources so that all the pages requests can
| > reference
| > | > | > those
| > | > | > shared objects....
| > | > | >
| > | > | > In addition, ASP.NET appliation in VS.NET can help us create
| > typed
| > | > | > dataset
| > | > | > and a TableAdapter through design surface, however, as I
| > mentioned,
| > | > due
| > | > to
| > | > | > the different programming model, ASP.NET will have limited
support
| > on
| > | > | > using
| > | > | > TableAdpater as winform application at design-time.... but
since
| > | > | > TableAdapter has encapsulated most code, we can just declare
| > certain
| > | > | > vartiables and create the instance to use them.....
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > --------------------
| > | > | > | From: "GaryDean" <[email protected]>
| > | > | > | Subject: 2.0 DataSources vs. TableAdapter/Datasets
| > | > | > | Date: Sat, 31 Dec 2005 14:29:31 -0800
| > | > | > | Lines: 25
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | > | NNTP-Posting-Host: user-vcaur7q.dsl.mindspring.com
| > 216.175.108.250
| > | > | > | Path:
| > | > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet:367882
| > | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > | > |
| > | > | > | We have been noticing that questions on vs.2005/2.0 don't
appear
| > to
| > | > get
| > | > | > much
| > | > | > | in answers so I'm reposting some questions posted by some of
the
| > | > | > programmers
| > | > | > | here in our organization that never got answered...
| > | > | > |
| > | > | > | There are articles on the new TableAdapters where it says
that a
| > key
| > | > new
| > | > | > | advantage is that a single TableAdapter, which can have
multiple
| > | > | > queries,
| > | > | > | can be used on multiple forms. Now that was in an article on
| > using
| > | > | > | TableAdapters with Forms Apps. There is a DataSource window
| > that
| > | > stores
| > | > | > | common datasources for the whole project (accessed via the
Data
| > menu
| > | > | > item).
| > | > | > |
| > | > | > | Now, back to ASP apps - there is no Data on the menu, no
| > datasource
| > | > | > window,
| > | > | > | and it looks like TableAdapters need to be generated from a
| > | > DataSource
| > | > | > | dropped on a page. Does this mean that aspx pages won't be
able
| > to
| > | > | > share
| > | > | > | TableAdapters?
| > | > | > |
| > | > | > | Also, in Form apps the IDE guids us to create the new 2.0 .XSD
| > | > datasets
| > | > | > that
| > | > | > | have TableAdapters where the ASP IDE guids us to create
| > DataSources
| > | > that
| > | > | > | don't create .XSDs with TableAdapters. Why the difference?
| > | > | > |
| > | > | > |
| > | > | > | --
| > | > | > | Regards,
| > | > | > | Gary Blakely
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 
S

Steven Cheng[MSFT]

You're welcome Gary,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "GaryDean" <[email protected]>
| References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| Date: Mon, 9 Jan 2006 09:40:16 -0800
| Lines: 589
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 216.244.8.41
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:369550
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Steven,
| Thanks for your help. that explains it very well.
| Gary
|
| --
| Regards,
| Gary Blakely
| Dean Blakely & Associates
| www.deanblakely.com
| | > Hi Gary,
| >
| > the xsd file in the App_Code folder is dynamically compiled into
assembly
| > which contains the DataSet and TableAdapter classes, that's why you do
not
| > find the designer.cs(vb) file as in winform project. To find the
| > TableAdapter class, just drag the ObjectDataSource and in the
| > configuration
| > wizard, when you need to choose the Business Object, check the "show
only
| > data components..."., the TableAdapter will appear in it...
| >
| > Also, if you just want to view the generated TableAdapter classes , open
| > the "Class View" through View--->Class View menu item, then in the
Class
| > view, you will find all the currently available classes in the project
| > which include the TableAdapter and DataSet ....
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | From: "GaryDean" <[email protected]>
| > | References: <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > <[email protected]>
| > | Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| > | Date: Fri, 6 Jan 2006 17:33:01 -0800
| > | Lines: 454
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: 216.244.8.41
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:369161
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | I'm having a hare time communicating my problem....
| > |
| > | I know that I need to specify the Datasets Class name in the typename
| > | property. My problem is that I can't find out where that class name
is
| > | specified! there is just a DataSet1.xsd and a DataSet1.xss file and
| > neither
| > | of those files have anything such as a class name.
| > |
| > | How do I find the class name??????\
| > |
| > | (in a forms app I created, I just had to double click the node of the
| > xsd
| > | file and a datasetDesigner.vb file got generated but this does not
work
| > in
| > | my asp app)
| > |
| > | Still searching for that magical class name...
| > | --
| > | Regards,
| > | Gary Blakely
| > | | > | > Thanks for your followup Gary,
| > | >
| > | > For TypeName, it just let us specify the Data Access Class's class
| > name,
| > | > also, as for
| > | > ==========
| > | > but there is no information at all on what DataSetTableAdapters is -
| > | > nothing.
| > | > ==========
| > | >
| > | > this is nothing related with ObjectDataSource or TableAdapter, it is
| > just
| > | > a
| > | > Namespace of the class(TableAdapter...). As we know, in .net
| > framework,
| > we
| > | > can group classes into a given namespace so as to avoid name clash
| > with
| > | > other company or studio's component package....
| > | >
| > | > So for the VS IDE generated TAbleAdapter/Dataset, they'll be
assigned
| > a
| > | > namespace, e.g:
| > | >
| > | > the following objectdatasource use a TableAdapter which has the
| > namespace
| > | > "DataSet1TableAdapters",
| > | >
| > | > =======================
| > | > <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
.........
| > | > SelectMethod="GetData"
| > | > TypeName="DataSet1TableAdapters.CategoriesTableAdapter"
| > | > .........>
| > | > ======================
| > | >
| > | > #namespace
| > | >
| >
http://msdn.microsoft.com/library/en-us/csref/html/vclrfnamespace.asp?frame=
| > | > true
| > | >
| > | > Also, if you're using VS IDE, you can use the design-time smart Tag
| > wizard
| > | > to list all the available data accessing components(include
| > | > TableAdapters )
| > | > in this project...
| > | >
| > | > Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | > --------------------
| > | > | From: "GaryDean" <[email protected]>
| > | > | References: <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > <[email protected]>
| > | > | Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| > | > | Date: Thu, 5 Jan 2006 18:10:27 -0800
| > | > | Lines: 310
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | X-RFC2646: Format=Flowed; Original
| > | > | Message-ID: <[email protected]>
| > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | NNTP-Posting-Host: 216.244.8.41
| > | > | Path:
| > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15.phx.gbl
| > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > microsoft.public.dotnet.framework.aspnet:368939
| > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > |
| > | > | Steven:
| > | > | I read the article you provided the hyperlink to with great
| > interest.
| > | > After
| > | > | spending hours pouring over the details in that article and
reading
| > the
| > | > help
| > | > | on ObjectDataSource.Typename property I cannot determine what to
put
| > | > into
| > | > | the ObjectDataSource Typename property. These docs are soooo bad.
| > | > |
| > | > | The article you pointed me to has
| > | > | TypeName="DataSetTableAdapters.PhotosTableAdapter" in the typename
| > | > property
| > | > | but there is no information at all on what DataSetTableAdapters
is -
| > | > | nothing.
| > | > |
| > | > | I have in my asp project Dataset1.xsd with a dataset named Orders
| > and
| > a
| > | > | TableAdapter named OrdersTableAdapter with methods FillOrders and
| > | > GetOrders.
| > | > | None of these names can be used in the Page_Load event as they
are
| > all
| > | > not
| > | > | defined.
| > | > |
| > | > | If you click on View Source in this article it is using
| > | > | TypeName="DataComponentTableAdapters.AlbumsTableAdapter" which
seems
| > at
| > | > odds
| > | > | with the article.
| > | > |
| > | > | The Help file for the Typename property shows
| > | > | typename="Samples.AspNet.CS.EmployeeLogic" but offers no
| > explainations
| > | > of
| > | > | where that came from or what that means. The help file says that
| > the
| > | > | TypeName property Gets or sets the name of the class that the
| > | > | ObjectDataSource object represents.
| > | > |
| > | > | So, I cannot figure out what to put in the typename property - I
| > can't
| > | > | figure out what the classname is.
| > | > |
| > | > | What should I put in the TypeName property?
| > | > |
| > | > | thanks,
| > | > | Gary
| > | > |
| > | > |
| > | > |
| > | > |
| > | > |
| > | > | --
| > | > | Regards,
| > | > | Gary Blakely
| > | > | Dean Blakely & Associates
| > | > | www.deanblakely.com
message
| > | > | | > | > | > Thanks for your response Gary,
| > | > | >
| > | > | > My answers in line:
| > | > | >
| > | > | > I can create a .xsd and TableAdapter for an ASP app in design
| > time.
| > | > | > However
| > | > | > vs.net 2005 does not allow me to connect that .xsd to my
GridView
| > at
| > | > | > design
| > | > | > time (as did vs 2003 allowed me to connect a .xsd to my
DataGrid).
| > So
| > | > | > because of this weakness I should do the following.....
| > | > | >
| > | > | > Create a .xsd in my App_Code folder. Create a class in my
| > App_Code
| > | > folder
| > | > | > that returns this dataset. Call this class from my aspx pages.
| > | > | >
| > | > | > Is this the best practice???
| > | > | > =============================================
| > | > | > Of course we can connect the created TableAdapter/ typed
Dataset
| > to
| > | > the
| > | > | > DataBound control at design-time, just use the ObjectDatasource
| > | > control,
| > | > | > and the steps to do this is:
| > | > | >
| > | > | > i) create the DataSet/TableAdatper pairs through wizard....
| > | > | > ii)drag a ObjectDataSource control onto the page want to use
that
| > | > | > TableAdapter/DataSet to retrieve data....
| > | > | > iii) configure the ObjectDataSource control to use the
| > TableAdapter
| > as
| > | > the
| > | > | > component class
| > | > | > iv) connect the databoundcontrol(gridview, detailsview...) to
the
| > | > | > objectdatasource...
| > | > | >
| > | > | > Here is the quickstart example which contains bind a
| > | > tableadapter/dataset
| > | > | > to asp.net databound control at design-time...:
| > | > | >
| > | > | > #ObjectDataSource
| > | > | >
| > | >
| >
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/data/objectdatasource.aspx
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > now, my rant....
| > | > | > It seems like vs2005 has taken us backwords. If we follow the
| > MSDN
| > | > | > articles
| > | > | > it has us creating DataSources for our gridviews that puts SQL
in
| > our
| > | > ASPX
| > | > | > pages (and that is not acceptable). vs2005 has also taken away
| > our
| > | > | > ability
| > | > | > to bind to datasets at design time - WHY? do I misunderstand?
| > | > | > ==============================================
| > | > | > And the VS2003's approch is actually based on some autogenerated
| > code
| > | > | > (inside the initializeComponents function...), this is
sometimes a
| > bit
| > | > | > hard
| > | > | > to maintain since it is IDE autogenerated.... While vs 2005
use
| > the
| > | > new
| > | > | > datasource control model which avoid much IDE generated code....
| > Just
| > | > put
| > | > | > datasource control at configure it in page template statically
(no
| > | > much
| > | > | > code needed....)
| > | > | >
| > | > | > Also, though SQLDataSource control need to specify sql
statement
| > in
| > | > aspx
| > | > | > template, you can choose to precompiled page so that no aspx
| > content
| > | > will
| > | > | > be exposed at deployment time... Also, sqldatasource provide a
| > rapid
| > | > data
| > | > | > access developing approach which is suitable for some simple
| > | > application
| > | > | > or
| > | > | > design prototype.... ObjectDataSource provide the more
flexible
| > and
| > | > | > advanced means to connect to different data access layer....
| > | > | >
| > | > | > Thanks,
| > | > | >
| > | > | > Steven Cheng
| > | > | > Microsoft Online Support
| > | > | >
| > | > | > Get Secure! www.microsoft.com/security
| > | > | > (This posting is provided "AS IS", with no warranties, and
confers
| > no
| > | > | > rights.)
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | >
| > | > | > --------------------
| > | > | > | From: "GaryDean" <[email protected]>
| > | > | > | References: <[email protected]>
| > | > | > <[email protected]>
| > | > | > | Subject: Re: 2.0 DataSources vs. TableAdapter/Datasets
| > | > | > | Date: Tue, 3 Jan 2006 10:25:25 -0800
| > | > | > | Lines: 135
| > | > | > | X-Priority: 3
| > | > | > | X-MSMail-Priority: Normal
| > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | Message-ID: <[email protected]>
| > | > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | > | NNTP-Posting-Host: user-vcauk40.dsl.mindspring.com
| > 216.175.80.128
| > | > | > | Path:
| > | > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > | > microsoft.public.dotnet.framework.aspnet:368327
| > | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > | > |
| > | > | > | Steven,
| > | > | > | Please tell me if this is correct...
| > | > | > |
| > | > | > | I can create a .xsd and TableAdapter for an ASP app in design
| > time.
| > | > | > However
| > | > | > | vs.net 2005 does not allow me to connect that .xsd to my
| > GridView
| > at
| > | > | > design
| > | > | > | time (as did vs 2003 allowed me to connect a .xsd to my
| > DataGrid).
| > | > So
| > | > | > | because of this weakness I should do the following.....
| > | > | > |
| > | > | > | Create a .xsd in my App_Code folder. Create a class in my
| > App_Code
| > | > | > folder
| > | > | > | that returns this dataset. Call this class from my aspx
pages.
| > | > | > |
| > | > | > | Is this the best practice???
| > | > | > |
| > | > | > | now, my rant....
| > | > | > | It seems like vs2005 has taken us backwords. If we follow the
| > MSDN
| > | > | > articles
| > | > | > | it has us creating DataSources for our gridviews that puts
SQL
| > in
| > | > our
| > | > | > ASPX
| > | > | > | pages (and that is not acceptable). vs2005 has also taken
away
| > our
| > | > | > ability
| > | > | > | to bind to datasets at design time - WHY? do I misunderstand?
| > | > | > |
| > | > | > | --
| > | > | > | Regards,
| > | > | > | Gary Blakely
| > message
| > | > | > | | > | > | > | > Hi Gary,
| > | > | > | >
| > | > | > | > Welcome.
| > | > | > | > As for the TableAdapter's different design mode and
behavior
| > in
| > | > net
| > | > | > 2.0
| > | > | > | > winform app and asp.net application ,here are some of my
| > | > understanding
| > | > | > and
| > | > | > | > suggestions:
| > | > | > | >
| > | > | > | > For the different design-time support and behavior on using
| > | > | > TableAdpater
| > | > | > | > components in winform application and asp.net application,
it
| > is
| > | > due
| > | > | > to
| > | > | > | > the
| > | > | > | > different underlying application nature and programming
model.
| > | > Winform
| > | > | > | > application is desktop app where all the class instances and
| > | > componets
| > | > | > | > live
| > | > | > | > in the application's memorty space as long as the
application
| > keep
| > | > | > | > alive...
| > | > | > | > While for asp.net application, it is request/response based,
| > | > asp.net
| > | > | > page
| > | > | > | > instance only live when a request arrive server and being
| > | > processed,
| > | > | > after
| > | > | > | > request finished, the page object will disposed(also,
mulitple
| > | > page
| > | > | > | > instances won't have relations to each other.... ) , so we
| > should
| > | > not
| > | > | > use
| > | > | > | > the same programming model as winform app.
| > | > | > | >
| > | > | > | > For sharing component instance or class objects in asp.net
| > | > | > application,
| > | > | > we
| > | > | > | > can use the following means:
| > | > | > | >
| > | > | > | > 1. Create the shared component instance and store it in a
| > global
| > | > wide
| > | > | > | > storage, e.g the ApplicationState or Application Cache is
the
| > | > | > reasonable
| > | > | > | > place for storing such component....
| > | > | > | >
| > | > | > | > 2. Also, if your applcation always running in a single
| > appdomain,
| > | > you
| > | > | > can
| > | > | > | > consider using a certain class's public static member
property
| > to
| > | > hold
| > | > | > | > such
| > | > | > | > shared data or resources so that all the pages requests can
| > | > reference
| > | > | > | > those
| > | > | > | > shared objects....
| > | > | > | >
| > | > | > | > In addition, ASP.NET appliation in VS.NET can help us
create
| > | > typed
| > | > | > | > dataset
| > | > | > | > and a TableAdapter through design surface, however, as I
| > | > mentioned,
| > | > | > due
| > | > | > to
| > | > | > | > the different programming model, ASP.NET will have limited
| > support
| > | > on
| > | > | > | > using
| > | > | > | > TableAdpater as winform application at design-time.... but
| > since
| > | > | > | > TableAdapter has encapsulated most code, we can just declare
| > | > certain
| > | > | > | > vartiables and create the instance to use them.....
| > | > | > | >
| > | > | > | > Thanks,
| > | > | > | >
| > | > | > | > Steven Cheng
| > | > | > | > Microsoft Online Support
| > | > | > | >
| > | > | > | > Get Secure! www.microsoft.com/security
| > | > | > | > (This posting is provided "AS IS", with no warranties, and
| > confers
| > | > no
| > | > | > | > rights.)
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | >
| > | > | > | > --------------------
| > | > | > | > | From: "GaryDean" <[email protected]>
| > | > | > | > | Subject: 2.0 DataSources vs. TableAdapter/Datasets
| > | > | > | > | Date: Sat, 31 Dec 2005 14:29:31 -0800
| > | > | > | > | Lines: 25
| > | > | > | > | X-Priority: 3
| > | > | > | > | X-MSMail-Priority: Normal
| > | > | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | > | > | > | X-RFC2646: Format=Flowed; Original
| > | > | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | > | > | > | Message-ID: <[email protected]>
| > | > | > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | > | > | > | NNTP-Posting-Host: user-vcaur7q.dsl.mindspring.com
| > | > 216.175.108.250
| > | > | > | > | Path:
| > | > | > TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| > | > | > | > | Xref: TK2MSFTNGXA02.phx.gbl
| > | > | > | > microsoft.public.dotnet.framework.aspnet:367882
| > | > | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > | > | > | > |
| > | > | > | > | We have been noticing that questions on vs.2005/2.0 don't
| > appear
| > | > to
| > | > | > get
| > | > | > | > much
| > | > | > | > | in answers so I'm reposting some questions posted by some
of
| > the
| > | > | > | > programmers
| > | > | > | > | here in our organization that never got answered...
| > | > | > | > |
| > | > | > | > | There are articles on the new TableAdapters where it says
| > that a
| > | > key
| > | > | > new
| > | > | > | > | advantage is that a single TableAdapter, which can have
| > multiple
| > | > | > | > queries,
| > | > | > | > | can be used on multiple forms. Now that was in an
article
| > on
| > | > using
| > | > | > | > | TableAdapters with Forms Apps. There is a DataSource
window
| > | > that
| > | > | > stores
| > | > | > | > | common datasources for the whole project (accessed via the
| > Data
| > | > menu
| > | > | > | > item).
| > | > | > | > |
| > | > | > | > | Now, back to ASP apps - there is no Data on the menu, no
| > | > datasource
| > | > | > | > window,
| > | > | > | > | and it looks like TableAdapters need to be generated from
a
| > | > | > DataSource
| > | > | > | > | dropped on a page. Does this mean that aspx pages won't
be
| > able
| > | > to
| > | > | > | > share
| > | > | > | > | TableAdapters?
| > | > | > | > |
| > | > | > | > | Also, in Form apps the IDE guids us to create the new 2.0
| > .XSD
| > | > | > datasets
| > | > | > | > that
| > | > | > | > | have TableAdapters where the ASP IDE guids us to create
| > | > DataSources
| > | > | > that
| > | > | > | > | don't create .XSDs with TableAdapters. Why the
difference?
| > | > | > | > |
| > | > | > | > |
| > | > | > | > | --
| > | > | > | > | Regards,
| > | > | > | > | Gary Blakely
| > | > | > | > |
| > | > | > | > |
| > | > | > | > |
| > | > | > | >
| > | > | > |
| > | > | > |
| > | > | > |
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|
 

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