Session and Database Connection, Which Is More Costy?



I am just curious about this issue.

I have a few buttons on a single aspx page. Each time one of the
buttons is clicked, I need to know if a customer has an unpaid
balance.

I only know of 2 ways to handle this:

1. Open the database connection only when the page is loaded the first
time, check the database for unpaid balance and save it as a session
variable. (Thus avoiding repetitive db connections.)

2. Upon clicking of each button on the page, I open up the database
and check the database for unpaid balance. (Thus avoiding session
variables.)

I heard through the grapevine that database connection is costy. In
the same manner, I heard that session will cause a scalability
problem.

So, in situations like this, what factors help us decide which
strategy to use?

Also, how about saving the value in a hidden field?

.


Loading