473,769 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programming - Best Practice

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 their
finally statement

Try
......
Catch
......
Finally

If (Not IsNothing(dbCon n)) Then
dbConn.Close()
End If

End Try

Will my data connection always close using this method or should I
just use dbConn.close?

I have a program that seems to be holding onto its connection - am I
missing something?

Feb 16 '07
51 3662
I've read 3 different figures for 'how much memory it takes on a db
server to leave a connection open'

I've got a couple of MS press books that claim 8kb.

I've got a couple of MS press books that claim 500kb.
and I just finished another SQL 2005 cert; and the figure that they
claimed there was 24k.

So if I've got a server with 1gb ram.. and a half dozen users.. what's
the big deal with leaving a half dozen connections OPEN?

it helps troubleshoot tremendously.

I mean.. how are you supposed to see sql statements when you can't
tell what spid they are?
I mean.. how are you supposed to see sql statements when you can't
tell what spid they are?
I mean.. how are you supposed to see sql statements when you can't
tell what spid they are?
I mean.. how are you supposed to see sql statements when you can't
tell what spid they are?
during development; ESPECIALLY-- it really helps to keep a half dozen
connections OPEN and see how things interact with each other; instead
of just 'close things as fast as you can and HOPE for the best'

that's what ADO.net is shoving down our throats.

'close connections as fast as you can and HOPE for the best'

and I don't believe in that type of 'fly by night' operation

if I wanted a nickel and dime data layer; I'd shop at Kmart
i used to have the choice to open a connection or close it. it was as
simple as changing a single variable in between a STRING and a
ADO.Connection.

i used to have the choice to open a connection or close it. it was as
simple as changing a single variable in between a STRING and a
ADO.Connection.

i used to have the choice to open a connection or close it. it was as
simple as changing a single variable in between a STRING and a
ADO.Connection.

i used to have the choice to open a connection or close it. it was as
simple as changing a single variable in between a STRING and a
ADO.Connection.

now?
MS FORCED THEIR PREMISE - that leaving connections open is bad- down
our throats.

AND I DO NOT ACCEPT THE ABILITY OF MS TO MAKE DECISIONS LIKE THIS
WITHOUT FIRST CONSULTING _ME_

Obviously they've proven that they are incapable of releasing stable
dependable software.
I mean, Visual Studio 2005 Pro, even with SP1 crashes 2 or 3 times a
day.

SO FUCK MS
On Feb 20, 5:59 am, "Michael D. Ober" <obermd.@.alum. mit.edu.nospam>
wrote:
There's another benefit to designing systems to open and close connections,
especially connections that sit idle most of the time. If your clients
assume that the connection is always open once it is opened, any burp that
causes the server to drop the connection will crash the client. If the
client doesn't make this assumption, a dropped connection is no big deal,
which also means the server can drop idle connections to free resources and
the client will simply reconnect when it needs to.

Mike Ober.

"CodeMonkey " <spamm...@suck. comwrote in message

news:um******** *****@TK2MSFTNG P04.phx.gbl...
PFC Sadr wrote:
I don't WANT to manually close it.
I want to leave it OPEN.
I don't see the point of opening it and re-opening it and all that
crap
and you can't utilize temp tables if your provider keeps on randomly
closing connections
uh; like seriously here
let's talk about programming apps for small business.
why would I constantly open and close and open and close connections??
This is especially important for small businesses. If a company has 10 PCs
that need to connect to an SQL server throughout the day, but not every PC
needs to look at the data all day, they might be able to get away with 5
licenses. If you keep those connections open the whole time the
application is open, you couldn't do that. We even have a company that
needs 8 people to connect to it constantly through the day. We close
connections and only open them when needed. They have 5 licenses and have
never had a problem. It's very cost effective.
It's also important for large companies. Having 100 connections open all
day is not very efficient when you can have 10 - 25 connections opening
and closing. Less load on the server...
It's just smarter and more efficient.- Hide quoted text -

- Show quoted text -

Feb 21 '07 #51
I fully agree.

I wish that MS had some sort of logic; instead of just forcing their
premonitions upon us


in ADO we can either use pooling or keep a connection open.

it it as easy as changing a single line of code and it's globally
changed EVERYWHERE

DREAM FUCKING WEAVER KIDS

they don't make you jump through hoops and play word games

fuck M$

On Feb 20, 10:20 pm, "PFC Sadr" <pfc_s...@hotma il.comwrote:
and it will keep the same SPID?

not the last time I checked.

why would a company invent a new library and then play word games like
this?

keeping a connection open shoudl keep the same SPID should it not?

On Feb 20, 5:06 am, "Brian Gideon" <briangid...@ya hoo.comwrote:
On Feb 20, 12:27 am, "aaron.ke...@gm ail.com" <aaron.ke...@gm ail.com>
wrote:
Cor
I don't understand what you're trying to say to me here.
Are you saying that you are GLAD that they automagically close
connections?
IT SHOULD BE OPTIONAL NOT MANDATORY
JUST LIKE IT WAS IN ADO; USING CONNECTION SHARING
Hi,
Like Spam said, closing a connection in ADO.NET is optional. You can
keep that IDbConnection object open as long as you'd like.
Brian- Hide quoted text -

- Show quoted text -

Feb 21 '07 #52

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

Similar topics

136
9447
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
12
8480
by: G. | last post by:
Hi all, During my degree, BEng (Hons) Electronics and Communications Engineering, we did C programming every year, but I never kept it up, as I had no interest and didn't see the point. But now I really want to get back into it as I see a point with GNU/Linux. I want to get my old skills back and write something or help on some projects etc. I need some good books. I used to have one called "A Book On C", but sold it,
8
2387
by: Dale | last post by:
I've searched Amazon and read probably 100 reviews but can't find what seems to be any book that is widely accepted as the definitive book on object oriented programming design and techniques. And most of the highest rated are all written 10 to 15 years ago. Any good suggestions?
19
2303
by: JoeC | last post by:
I have seen many books that teack coding for C++. What are ways to improve my techniques for writing larger programs. I have written many demo programs learning some aspects of code wether it be dynamic binding or creating function and I understand most of that but how can I learn and employ techniques to make my programs better. I try to employ the lessons I learn in the programs that I write. Acclerated C++ is the best book I have...
3
1480
by: Ray | last post by:
OK, maybe I shoot a more general question to the group since there are so many great programmers here: how do you practice your craft? I do it in the following way: 1. Set aside 30 minutes to 1 hour a day to read up on the latest development, be it about the tool I'm using, the language, or the platform, or the framework, etc. 2. Once every 1-2 months, go to Amazon, and look for the book with the
7
1509
by: Michael | last post by:
Hey, I'm, I guess, an itermediate programmer and I have a question about learning any programming language. I understand that as a programmer you're going to probably constantly be re-writing code and the best method would be to save a template or other etc. I also know that it's ok to use other people's code to help you do something, but wouldn't it be best to re-type the code or study it until YOU learn how to do it and you actually...
7
4963
by: Robert Seacord | last post by:
The CERT/CC has just deployed a new web site dedicated to developing secure coding standards for the C programming language, C++, and eventually other programming language. We have already developed significant content for the C programming language that is available at: https://www.securecoding.cert.org/ by clicking on the "CERT C Programming Language Secure Coding Standard"
6
1344
by: Michael | last post by:
Hi, A quick and most likely simply question about which is generally better programming with PHP. Is it more proper to break out of PHP code to write HTML, or is it ok rto do it within print() statements? Such as... SCRENARIO A) <?php ....code... ?>
9
1901
by: Smithers | last post by:
Please consider this humble method: public void ResetCounters() { m_TotalExceptionsDetected = 0; m_TotalMessagesSent = 0; } Given no further information, would you wrap those two lines in a try... catch block?
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.