accessing the same DB with two calls in two usercontrols...good? bad?

D

Darrel

I have a page with a few user controls.

One is the HEADERTAGS (that writes out the tags in the <header> of the page)
and one is MAINCONTENT (that writes out the main body content on the page)

I'm storing the TITLE tag data and the main text data in the same table. How
should I handle getting the above data from this one table via the two
Usercontrols above?

Is it fine to simply have both open a separate connection and grab the
pertinent data? Should only one control grab the data and pass the
information to the other? Does it really matter performance wise on a
smaller site?

-Darrel
 
J

jongalloway

Technically it's bad, although I wouldn't worry about it on a small
site.

If you're using standard data access against SQL Server, ADO.NET is
probably pooling your connections which further cuts down on the
performance penalty.

If you wanted to optimize this, I'd have the page which contains the
usercontrols do the database hit and set properties in the
usercontrols. That's worked well for me in several production
applications.

- Jon
http://weblogs.asp.net/jgalloway
 
D

darrel

If you wanted to optimize this, I'd have the page which contains the
usercontrols do the database hit and set properties in the
usercontrols. That's worked well for me in several production
applications.

Hmm...good idea. I'm not going to worry about it for this site (it's so
small) but in the future I think perhaps I'll have once control that's in
charge of getting all data and passing that to the appropriate other
controls.

-Darrel
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top