Last post Jan 16, 2011 09:58 PM by decker dong - msft
Jan 14, 2011 08:01 AM|fialbz|LINK
I have SqlDataSource in 2 pages: Page1.aspx and Page2.aspx. I setup all SqlDataSource with EnableCaching is "True" and CacheDuration is “Infinite”, same setup for all 2 SqlDataSource as below:
ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM
When visitor access Page1.aspx, the SqlDataSource in Page1.aspx will access SQL server to retrieve database and cache the database.
Question-1: After accessing Page1.aspx, then the visitor access Page2.aspx. Will visitor access again SQL Server database in Page2.aspx?
Question-2: One cache at one SqlDataSource is for one page and for one user?
Or, one cache at one SqlDataSource is for multiple pages and for one user? Or, one cache at one SqlDataSource is for multiple pages and for multiple users?
Please advice by stating Answer-1 and Answer-2.
Jan 14, 2011 09:28 AM|egor598|LINK
Question1: Yes, user will access database again in page 2 if/or because you use different sqldatasource object.
Question2: One SqlDataSource object per one cache, your data will be persisted accross page postbacks
Quote from MSDN article about SqlDataSource:
The SqlDataSource control maintains a separate cache item for each combination of ConnectionString,
SelectCommand, and SelectParameters values.
Jan 14, 2011 04:13 PM|fialbz|LINK
All two SqlDataSource are using the same “ConnectionString” and the same “SelectCommand” string (it's same database table and database column). Is it still accessing SQL Server database in Page2.aspx?
Jan 16, 2011 09:58 PM|decker dong - msft|LINK
I think so. Because every control has nothing to do with each other in different pages. And when you bind to the gridview, in fact
it will call the Select method automatically seperately.