public DbFieldBase Type2Object(Type fieldType) { DbFieldBase oField = null; if (fieldType == typeof(Boolean)) { oField = new DbBooleanField(); } else if (fieldType == typeof(Int16)) { oField = new DbInt16Field(); } else if (fieldType == typeof(Int32)) { oField = new DbInt32Field(); } else if (fieldType == typeof(Int64)) { oField = new DbInt64Field(); } else if (fieldType == typeof(UInt16)) { oField = new DbUInt16Field(); } else if (fieldType == typeof(UInt32)) { oField = new DbUInt32Field(); } else if (fieldType == typeof(UInt64)) { oField = new DbUInt64Field(); } else if (fieldType == typeof(Single)) { oField = new DbSingleField(); } else if (fieldType == typeof(Double)) { oField = new DbDoubleField(); } else if (fieldType == typeof(String)) { oField = new DbStringField(); } return(oField); }
public DbFieldBase Type2Object(string strType) { DbFieldBase oField = null; if (strType.Equals(typeof(Boolean).Name)) { oField = new DbBooleanField(); } else if (strType.Equals(typeof(Int16).Name)) { oField = new DbInt16Field(); } else if (strType.Equals(typeof(Int32).Name)) { oField = new DbInt32Field(); } else if (strType.Equals(typeof(Int64).Name)) { oField = new DbInt64Field(); } else if (strType.Equals(typeof(UInt16).Name)) { oField = new DbUInt16Field(); } else if (strType.Equals(typeof(UInt32).Name)) { oField = new DbUInt32Field(); } else if (strType.Equals(typeof(UInt64).Name)) { oField = new DbUInt64Field(); } else if (strType.Equals(typeof(Single).Name)) { oField = new DbSingleField(); } else if (strType.Equals(typeof(Double).Name)) { oField = new DbDoubleField(); } else if (strType.Equals(typeof(String).Name)) { oField = new DbStringField(); } return(oField); }