Classes and SQL Database in ASP.net

G

Guest

I would like to first start off saying that this is pretty much my first week
of heavily getting into ASP.net. I previously have programmed in ASP Classic,
and now understanding the benefits of ASP.net I would like to cross over.

Anyways onto my question. I am curious how i can go about setting up a class
with the connection to my database in it, which any page can use to connect
to that database. I was never heavily in classes or functions during my ASP
years, so please bare with me.

Thank you so much for all your help...
Also if you know of any good example sites with source i can look at and
read that might further my education on this subject, since that is the best
way i can learn..

~Devin
 
K

Kevin Spencer

Hi Devin,

Good choice migrating to ASP.Net. Now, get ready to start thinking
differently!
Anyways onto my question. I am curious how i can go about setting up a class
with the connection to my database in it, which any page can use to connect
to that database. I was never heavily in classes or functions during my ASP
years, so please bare with me.

ADO.Net uses Connection Pooling. This is a marked contrast to ADO, where it
was often a good idea to keep a Connection opened, due to the overhead of
creating a new one. With ADO.Net, it is actually a best practice to open and
close Connections as quickly as possible. When they are closed, they are
released into a Pool, where they can be re-used inexpensively, and of course
the advantage is that you don't need to maintain opened (and unused)
Connections. In some cases, it is imperative that you close them. For
example, 2 DataReaders cannot use the same Connection at the same time.
Also if you know of any good example sites with source i can look at and
read that might further my education on this subject, since that is the best
way i can learn..

The .Net SDK is a free download, and is some of the best software
documentation I've ever read:

http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

And check out Microsoft's ASP.Net site: http://www.asp.net

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 

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

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top