I have not used a dataset, never, and I would like to know if it could be useful to me and make my work easier. I have a page with several tabs with grids, that grids have a common column, "Categories", in every tab I have a SqlDataSource with a table, "Categories",
to show the name as a ComoBox in the grids. May I replace all the SqlDataSources for a TableAdater in the DataSet and, in the case I needed to add a where clause, could I do that?
I would be interested also in having a General table and read a single value, such as a percentage, a constant, a company name,... something that would only return a row and a value.
All the examples I have found are about read from a TableAdapter and display the records in a grid, but nothing referenced to add a where at runtime or read a single value with no need to create a DataView and more stuff.
May I replace all the SqlDataSources for a TableAdater in the DataSet and, in the case I needed to add a where clause, could I do that?
Yes, but I wonder why? SqlDataSource is most easy than TableAdapter, if compared.
jos3
I would be interested also in having a General table and read a single value, such as a percentage, a constant, a company name,... something that would only return a row and a value.
For returning a single result, you have to use SqlCommand instead of DataSource.
jos3
Member
7 Points
43 Posts
How to properly use a typed dataset (*.xsd)
Jan 26, 2013 09:01 PM|LINK
Hi,
I have not used a dataset, never, and I would like to know if it could be useful to me and make my work easier. I have a page with several tabs with grids, that grids have a common column, "Categories", in every tab I have a SqlDataSource with a table, "Categories", to show the name as a ComoBox in the grids. May I replace all the SqlDataSources for a TableAdater in the DataSet and, in the case I needed to add a where clause, could I do that?
I would be interested also in having a General table and read a single value, such as a percentage, a constant, a company name,... something that would only return a row and a value.
All the examples I have found are about read from a TableAdapter and display the records in a grid, but nothing referenced to add a where at runtime or read a single value with no need to create a DataView and more stuff.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to properly use a typed dataset (*.xsd)
Jan 28, 2013 12:56 AM|LINK
Yes, but I wonder why? SqlDataSource is most easy than TableAdapter, if compared.
For returning a single result, you have to use SqlCommand instead of DataSource.
jos3
Member
7 Points
43 Posts
Re: How to properly use a typed dataset (*.xsd)
Feb 03, 2013 04:30 PM|LINK
That is what I have been using.
Does anyone usea DataSet, for what purpose?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: How to properly use a typed dataset (*.xsd)
Feb 03, 2013 11:58 PM|LINK
Yes. DataSet is used when you wanna dynamically change the SQL select statement and fetch all the data contents into the DataTable.
For a fixed SQL select string, we'd better use SqlDataSource.
jos3
Member
7 Points
43 Posts
Re: How to properly use a typed dataset (*.xsd)
Feb 10, 2013 03:28 PM|LINK
Ok, thanks