473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

setting Best Practice ADO.NET connections

Hi,

I am a relatively new user to vs.NET, and currently developing a
ASP.NET web site using MS access, with the view to moving it to
SQLServer. My problem is, how do I set up the connection to be utilise
connection pooling, and to be easily maintained and modified. I was
thinking of setting up a DSN, which is how I am currently connecting
in ASP but I'm not sure how to do it in .NET. So I created a class
which opens a connection and puts it in a readonly property, imports
the class in each page and sets the connection to that property. but
this is eatreamly sloppy, and cant be the best way to do this.
any help would be greatly appreciated. Thanks
Nov 18 '05 #1
2 1133

"Steve" <st***************@cba.com.au> wrote in message
news:19**************************@posting.google.c om...
Hi,

I am a relatively new user to vs.NET, and currently developing a
ASP.NET web site using MS access, with the view to moving it to
SQLServer. My problem is, how do I set up the connection to be utilise
connection pooling,
Connections in .NET automatically use Connection Pooling.

and to be easily maintained and modified.

You can store the connection string in the web.config file, so it doesn't
have to be included (or repeated) in the actual modules.
I was thinking of setting up a DSN, which is how I am currently connecting in ASP but I'm not sure how to do it in .NET. So I created a class
which opens a connection and puts it in a readonly property, imports
the class in each page and sets the connection to that property. but
this is eatreamly sloppy, and cant be the best way to do this.
any help would be greatly appreciated. Thanks


Personally, I stopped using DSN's about 5 years ago when OLE DB hit the
scene.
Nov 18 '05 #2
Steve wrote:
I am a relatively new user to vs.NET, and currently developing a
ASP.NET web site using MS access, with the view to moving it to
SQLServer. My problem is, how do I set up the connection to be utilise
connection pooling, and to be easily maintained and modified. I was
thinking of setting up a DSN, which is how I am currently connecting
in ASP but I'm not sure how to do it in .NET.

If you are moving to SQL Server 2000, then you will want to use the
Sql Server .NET Data Provider (SqlClient). If you use a DSN, it will
use the older ODBC Sql Driver. You can also use OLEDB SQL Server
Provider. But you best bet is to use SqlClient.
http://www.able-consulting.com/dotne..._Providers.htm

So I created a class
which opens a connection and puts it in a readonly property, imports
the class in each page and sets the connection to that property. but
this is eatreamly sloppy, and cant be the best way to do this.
any help would be greatly appreciated.


Take advantage of connection pooling by opening, using, and then closing
the connection each time you need to access the database.
http://msdn.microsoft.com/library/en...taProvider.asp

For best practices, check out
http://msdn.microsoft.com/library/en.../html/daag.asp

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
2
by: Joe Bloggs | last post by:
I have a general question on best practice regarding data access. I have the code below, a static method defined in a class that I use in a data layer dll. The method takes a string as its...
0
by: Ken Foster | last post by:
I built some remote services, a couple singletons and one single call. On the client side I thought I'd save on connection latency by caching the remote connection in a shared variable. Create it...
4
by: Sandy | last post by:
Hello - I read an interesting article on the web wherein the author states he doesn't handle too many errors at page level, but handles them at the application level. He further goes on to show...
20
by: Keith G. Murphy | last post by:
I'm trying to get a feel for what most people are doing or consider best practice. Given a mod_perl application talking to a PostgreSQL database on the same host, where different users are...
1
by: Dave | last post by:
I have two environments: DEV and PROD. In DEV I have two independent webs. In PROD one of the webs is the root and the other is a subweb of the root. Each enviornment has a different file system...
9
by: david | last post by:
I have a class with some business-logic and with every roundtrip, I need an instance of this class, so I have to create it, every time again. That doesn't seem very efficient. I thought it would...
51
by: bigHairy | last post by:
Hello. I have been teaching myself .NET over the last few months and have had some success. I would like to ask a question though... A number of examples I have followed have the following in...
3
by: Venkat | last post by:
Hi, We have a windows application developed in c# and SQL Server 2005. Our application need to execute more than one command (ExecuteReader and ExecuteScalar) at a single time. Till now we have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.