Re: Handling data relations in Gridview
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Mon, 12 Jun 2006 09:48:32 GMT
Thanks for your response Bill,
===========================
I guess the alternative to achieving the
same functionality is to use stored procedures for the CRUD interface
but ... you lose the caching from the dataset, Correct?
==========================
Agree, actually I had ever thought about suggest you do the table join at
database layer(through T-SQL in stored procedure ...), but I gave it up
since I assume that you're looking for a application layer approach(in .net
code) :-).
Anyway, I think use T-SQL join will have better performance for the data
generation, and about the cache you mentioned, if the whole data is not
changable, we can still cache the returned result set(if you load it into a
DataSet/DataTable) in our application cache.
BTW, how about creating a View for this particular resultset, then, at
appliaction layer(ADO.NET), we just treat it as a normal DataTable. Anyway,
you can post this in DataBase specific groups for better ideas in database
layer.
==============================
Are there any other options? The one I outlined below is interesting,
but it seems you are getting the same data twice. If I could some how
Fill()'s for the two related tables (two fills thru two table
adapters), then build a third table from the cached tables to satisfy
the relation .... Am I insane or is there something missing from the
FW?
==============================
Sorry but I'm not very clear on this you mentioned, would provide some
further description. As far I know, as for single DataAdapter, you can fill
muliple datatables (into a dataset) through one "Fill" call. You can
specify a multiple-select query statement for the DataAdapter, e.g.
====================
protected void Page_Load(object sender, EventArgs e)
{
string strSql = "select CategoryID, CategoryName from
Categories;select ProductID, ProductName, CategoryID from Products";
SqlConnection conn = new
SqlConnection(WebConfigurationManager.ConnectionStrings["LocalNorthwindConnS
tr"].ConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter(strSql, conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
Response.Write("<br/>Table Count: " + ds.Tables.Count);
}
=========================
After you got the DataTable at .net layer, you should determine how to
cache those tables. It is hard to provide a common strategy since that
mostly depend on your data's relationship and how will they be used in the
application(how frequent, how changable?)...
Hope this also helps some.
Regards,
Steven Cheng
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
.
- Follow-Ups:
- Re: Handling data relations in Gridview
- From: Steven Cheng[MSFT]
- Re: Handling data relations in Gridview
- References:
- Handling data relations in Gridview
- From: sutphinwb@xxxxxxxxxxxxx
- Re: Handling data relations in Gridview
- From: sutphinwb@xxxxxxxxxxxxx
- Handling data relations in Gridview
- Prev by Date: Re: Need process to detect if network is available
- Next by Date: Re: OnChange Javascript - IE vs Firefox
- Previous by thread: Re: Handling data relations in Gridview
- Next by thread: Re: Handling data relations in Gridview
- Index(es):
Relevant Pages
|