I have a select like this
object endTime = null;
string selectCommandText = "SELECT endtime FROM alapplication WHERE applicationid='" + application + "'";
DbProviderFactory dbf = DbProviderFactories.GetFactory("Npgsql");
using (IDbConnection conn = dbf.CreateConnection())
{
     conn.ConnectionString = ASSettings.ConnectionInfo_MASTER;
     conn.Open();
     IDbCommand selectCommand = conn.CreateCommand();
     selectCommand.CommandText = selectCommandText;
     IDataReader reader = selectCommand.ExecuteReader();
     if (reader.Read())
     {
         endTime = reader.GetValue(reader.GetOrdinal("endtime"));
     }
     reader.Close();
     conn.Close();
     conn.Dispose();
}
where i want to read the value endtime which is of type timezone. The problem is that sometimes this value is null and then when i read it i have that endtime is like this
{}
so its like empty, NEITHER NULL NOR LIKE "". I don't know how to check whether it is like this or not, because if it is not like this that i can try to parse it to datetime like this
DateTime expireDate = DateTime.Parse(endTime.ToString());
For now I change the query to
string selectCommandText = "SELECT endtime FROM alapplication WHERE applicationid='" + application + "' AND endtime IS NOT NULL";
so if in the db endtime is null i will not get anything.. But I wanted to understand this thing because it happened to me other times..
