Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
C# DB Connection Code Question
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01311457
Message ID:
01311639
Views:
11
>
>By this is pretty good for a first attempt. What do you think?

Mind some constructive criticism? (I don't mean any of this to come across snarky)
These are just mostly "standards" people use, so it really won't effect how your code works in any way.

I'd suggest you use an enumeration instead of an integer, it makes the code a bit easier to read.

ex.
public enum ConnectionType
{
    Sql,
    OleDB,
    ODBC
}
Then your switch looks like:
switch (iConnectionType)
{
   // Sql Data Provider
    case ConnectionType.Sql:
...
}
Members of a class are also normally either private or protected. If you need to expose them, create a property (a member with a get/set).

ex..
private string sConnString = "";
public string ConnString
{
   get { return this.sConnString; }
   set { this.sConnString = value; }
}
Also, I think you'll find most .NET devs don't use type prefixes like we do in VFP. Local vars/parameters are camel case (lowerCase). Members are either name m_memberName or _memberName. Properties are usually ProperCase.
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform