System.Data.SqlClient.SqlConvert.DbTypeToSqlDbType C# (CSharp) Méthode

DbTypeToSqlDbType() static private méthode

static private DbTypeToSqlDbType ( DbType dbType ) : SqlDbType
dbType DbType
Résultat SqlDbType
		internal static SqlDbType DbTypeToSqlDbType(DbType dbType)
		{
			switch (dbType) {
				case DbType.AnsiString : return SqlDbType.VarChar;
				case DbType.Binary : return SqlDbType.VarBinary;
				case DbType.Byte : return SqlDbType.TinyInt;
				case DbType.Boolean : return SqlDbType.Bit;
				case DbType.Currency : return SqlDbType.Money;
				case DbType.Date : return SqlDbType.DateTime;
				case DbType.DateTime : return SqlDbType.DateTime;
				case DbType.Decimal : return SqlDbType.Decimal;
				case DbType.Double : return SqlDbType.Float;
				case DbType.Guid : return SqlDbType.UniqueIdentifier;
				case DbType.Int16 : return SqlDbType.SmallInt;
				case DbType.Int32 : return SqlDbType.Int;
				case DbType.Int64 : return SqlDbType.BigInt;
				case DbType.Object : return SqlDbType.Variant;
				case DbType.SByte : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");
				case DbType.Single : return SqlDbType.Real;
				case DbType.String : return SqlDbType.NVarChar;
				case DbType.UInt16 : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");
				case DbType.UInt32 : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");
				case DbType.UInt64 : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");
				case DbType.VarNumeric : throw ExceptionHelper.UnknownDataType(dbType.ToString(),"SqlDbType");
				case DbType.AnsiStringFixedLength : return SqlDbType.Char;
				case DbType.StringFixedLength : return SqlDbType.NChar;
				default : throw ExceptionHelper.InvalidDbType((int)dbType);
			}
		}