E
Emmanuel Mathew
Hi friends,
I have a method which is given below
public IDbConnection SetConnection(string connectionString)
{
try
{
IDbConnection connection;
switch (dbType)
{
case (int)DatabaseType.odbc:
connection = new OdbcConnection(connectionString);
break;
case (int)DatabaseType.oledb:
connection = new OleDbConnection(connectionString);
break;
case (int)DatabaseType.sqlClient:
connection = new SqlConnection(connectionString);
break;
default:
break;
}
return connection;
}
catch (Exception ex)
{
throw ex;
}
}
When this is compiled, a warning comes like "the object Connection is
unassigned or never used. So how can I initilize this object?
Thanks in Advance
Emmanuel Mathew
I have a method which is given below
public IDbConnection SetConnection(string connectionString)
{
try
{
IDbConnection connection;
switch (dbType)
{
case (int)DatabaseType.odbc:
connection = new OdbcConnection(connectionString);
break;
case (int)DatabaseType.oledb:
connection = new OleDbConnection(connectionString);
break;
case (int)DatabaseType.sqlClient:
connection = new SqlConnection(connectionString);
break;
default:
break;
}
return connection;
}
catch (Exception ex)
{
throw ex;
}
}
When this is compiled, a warning comes like "the object Connection is
unassigned or never used. So how can I initilize this object?
Thanks in Advance
Emmanuel Mathew