GetDataTypeName() public method

Gets the name of the source data type.
public GetDataTypeName ( int i ) : String
i int
return String
Beispiel #1
0
 public static DateTime GetDateTimeFromRdr(MySql.Data.MySqlClient.MySqlDataReader rdr, string column)
 {
     try
     {
         int ord = rdr.GetOrdinal(column);
         //if (rdr[ord] == DBNull.Value) return DateTime.MinValue;
         string typeName = rdr.GetDataTypeName(ord);
         if (typeName == "DATE")
         {
             rdr.GetMySqlDateTime(ord).GetDateTime();
         }
         return((DateTime)rdr[column]);
     }
     catch (Exception exc)
     {
         log.Error("GetDateTimeFromRdr", exc);
         return(DateTime.Now);
     }
 }
Beispiel #2
0
 public static int GetIntFromRdr(MySql.Data.MySqlClient.MySqlDataReader rdr, string column)
 {
     try
     {
         int ord = rdr.GetOrdinal(column);
         if (rdr[ord] == DBNull.Value)
         {
             return(0);
         }
         string typeName = rdr.GetDataTypeName(ord);
         if (typeName == "TINYINT")
         {
             return(rdr.GetInt16(ord));
         }
         return(rdr.GetInt32(ord));
     }
     catch (Exception exc)
     {
         log.Error("GetIntFromRdr", exc);
         return(0);
     }
 }