@vadlak12 well as I said before I appreciate you doing what you do. You are definately helping me to learn C# and I really appreciate it. Just thought for someone else who is a beginner no point in learning bad habits. Also noticed you sometimes when quoting code don’t point out that the = sign in C# is an assignment operand and doesn’t mean equal but you say equal. Thats different from VB where = does mean equal.
The way you have it you end up squandering some resources. On a desktop system it matters less(it still matters but not as much as web system.
I would rearrange a little
Do the declarations but don’t call the connection.open as early as you did
wrap the connection.open with a try catch, finally group
try
{
//Declarations here
connection.open():
command.ExecuteNonQuery :
Catch exception
{
*Do something with the exception
like notify the user*/
}
Finally
{Connection.Close();}
Comments
Leave a comment Trackback