GetDataTypeName() 공개 메소드

Gets the name of the source data type.
public GetDataTypeName ( int i ) : String
i int
리턴 String
예제 #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);
     }
 }
예제 #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);
     }
 }