private DataCommandParameterType GetParameterTypeFromDBType(string DBType, bool IsUserDefinedType, bool IsTable) { DataCommandParameterType retVal = DataCommandParameterType.String; string newType = "String"; if (IsUserDefinedType) { if (IsTable) { newType = "Structured"; } else { newType = "Object"; } } else { switch (DBType.ToLower()) { case "boolean": newType = "Boolean"; break; case "bit": newType = "Boolean"; break; case "binary": newType = "Binary"; break; case "varbinary": newType = "Binary"; break; case "blob": newType = "Binary"; break; case "tinyblob": newType = "Binary"; break; case "mediumblob": newType = "Binary"; break; case "longblob": newType = "Binary"; break; case "datetime": newType = "DateTime"; break; case "double": newType = "Double"; break; case "decimal": newType = "decimal"; break; case "serial": newType = "decimal"; break; case "float": newType = "Single"; break; case "tinyint": newType = "Byte"; break; case "bigint": newType = "Int64"; break; case "smallint": newType = "Int16"; break; case "mediumint": newType = "Int32"; break; case "int": newType = "Int32"; break; case "nvarchar": newType = "String"; break; case "varchar": newType = "String"; break; case "char": newType = "String"; break; case "nchar": newType = "String"; break; case "text": newType = "String"; break; case "mediumtext": newType = "String"; break; case "longtext": newType = "String"; break; case "date": newType = "Date"; break; case "time": newType = "Time"; break; case "year": newType = "Int16"; break; case "timestamp": newType = "Int64"; break; default: newType = "String"; break; } } retVal = (DataCommandParameterType)Enum.Parse(typeof(DataCommandParameterType), newType); return(retVal); }
private DataCommandParameterType GetParameterTypeFromDBType(string DBType, bool IsUserDefinedType, bool IsTable) { DataCommandParameterType retVal = DataCommandParameterType.String; string newType = "String"; if (IsUserDefinedType) { if (IsTable) { newType = "Structured"; } else { newType = "Object"; } } else { switch (DBType.ToLower()) { case "image": newType = "Object"; break; case "text": newType = "String"; break; case "uniqueidentifier": newType = "Guid"; break; case "tinyint": newType = "Int32"; break; case "smallint": newType = "Int32"; break; case "int": newType = "Int32"; break; case "smalldatetime": newType = "DateTime"; break; case "real": newType = "Decimal"; break; case "money": newType = "Decimal"; break; case "datetime": newType = "DateTime"; break; case "float": newType = "Single"; break; case "sql_variant": newType = "Object"; break; case "ntext": newType = "String"; break; case "bit": newType = "Boolean"; break; case "decimal": newType = "Decimal"; break; case "numeric": newType = "Decimal"; break; case "smallmoney": newType = "Decimal"; break; case "bigint": newType = "Int64"; break; case "varbinary": newType = "Binary"; break; case "varchar": newType = "String"; break; case "binary": newType = "Binary"; break; case "char": newType = "String"; break; case "timestamp": newType = "Int64"; break; case "nvarchar": newType = "String"; break; case "nchar": newType = "String"; break; default: newType = "String"; break; } } retVal = (DataCommandParameterType)Enum.Parse(typeof(DataCommandParameterType), newType); return(retVal); }