Re: Accessing Data and Try/Catch



You are absolutely correct about the error trapping.
Very poor...

As for the static methods, it looks like this was just
a console app sample and the programmer wasn't
trying to demonstrate OOP techniques.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
I've mapped the database to .NET class properties and methods to
implement an multi-layered object oriented environment for your
data access layer. Thus, you should rarely ever have to type the words
SqlCommand, SqlDataAdapter, or SqlConnection again.
http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp





"Jake K" <msnews.microsoft.com> wrote in message news:%23sfX1lsMHHA.4928@xxxxxxxxxxxxxxxxxxxxxxx
I've been reading throught MS article http://support.microsoft.com/kb/306636. I am in the process of learning C# and have a few questions. First, why are the methods (Pause, AddRecord,...) marked as static as opposed to private? Also, is it not best to include the objConn.Open(); statement in the try block instead of just the objCmd.ExecuteNonQuery(); statement. Suppose the db server wa not found, etc., would that error still be trapped because the cmd object uses it?



.


Loading