I have the following code which returns a SQL Connection object:
public SqlConnection GetConnection()
{
string sConnString = _GetConnString();
SqlConnection oConn = new SqlConnection();
oConn.ConnectionString = sConnString;
try
{
oConn.Open();
}
catch (SqlException e)
{
}
if (oConn.State == ConnectionState.Open)
{
return oConn;
}
else
{
return null;
}
}
I anticipate having to connect to other DB's, so I would like to create an abstract base
class that has the GetConnection method, as well as other data methods. It will also
have connection string and other DB related properties on it. Then, all I have to do is
subclass it and modify it where needed.
I'm not sure how to write a base class for this. Can anyone help out a newby?
Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people