V
VC
Why this works?
t = Type.GetType("GlobalDB.DBSqlServer");
GetType returns the type of the class and t is {Name = "DBSqlServer"
FullName = "GlobalDB.DBSqlServer"}
And why this don't works?
string dbInUse = "DBSqlServer";
string type = "GlobalDb." + dbInUse;
t = Type.GetType(type);
t is always null
why? this is driving me crazy
The class declaration:
namespace GlobalDB
{
public class DBSqlServer : DB
{
public DBSqlServer(string connStr)
{
if (connStr != null)
this.ConnectionString = connStr;
else
throw new ApplicationException("Connection String not
given");
}
// other stuff here
}
t = Type.GetType("GlobalDB.DBSqlServer");
GetType returns the type of the class and t is {Name = "DBSqlServer"
FullName = "GlobalDB.DBSqlServer"}
And why this don't works?
string dbInUse = "DBSqlServer";
string type = "GlobalDb." + dbInUse;
t = Type.GetType(type);
t is always null
why? this is driving me crazy
The class declaration:
namespace GlobalDB
{
public class DBSqlServer : DB
{
public DBSqlServer(string connStr)
{
if (connStr != null)
this.ConnectionString = connStr;
else
throw new ApplicationException("Connection String not
given");
}
// other stuff here
}