wuyong

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

根据数字段返回字段

public string GetSqlDbType(ColumnSchema column)
{
    
switch (column.NativeType)
    
{
        
case "bigint"return "BigInt";
        
case "binary"return "Binary";
        
case "bit"return "Bit";
        
case "char"return "Char";
        
case "datetime"return "DateTime";
        
case "decimal"return "Decimal";
        
case "float"return "Float";
        
case "image"return "Image";
        
case "int"return "Int";
        
case "money"return "Money";
        
case "nchar"return "NChar";
        
case "ntext"return "NText";
        
case "numeric"return "Decimal";
        
case "nvarchar"return "NVarChar";
        
case "real"return "Real";
        
case "smalldatetime"return "SmallDateTime";
        
case "smallint"return "SmallInt";
        
case "smallmoney"return "SmallMoney";
        
case "sql_variant"return "Variant";
        
case "sysname"return "NChar";
        
case "text"return "Text";
        
case "timestamp"return "Timestamp";
        
case "tinyint"return "TinyInt";
        
case "uniqueidentifier"return "UniqueIdentifier";
        
case "varbinary"return "VarBinary";
        
case "varchar"return "VarChar";
        
defaultreturn "__UNKNOWN__" + column.NativeType;
    }

}


返回Parameter类型

        swatch(col.NativeType)
        
{
            
case "bigint"return "SqlDbType.Bigint";
            
case "binary"return "SqlDbType.Binary";
            
case "bit"return "SqlDbType.Bit";
            
case "char"return "SqlDbType.Char";
            
case "datetime"return "SqlDbType.Datetime";
            
case "decimal"return "SqlDbType.Decimal";
            
case "float"return "SqlDbType.Float";
            
case "image"return "SqlDbType.Image";
            
case "int"return "SqlDbType.Int";
            
case "money"return "SqlDbType.Money";
            
case "nchar"return "SqlDbType.Nchar";
            
case "ntext"return "SqlDbType.Ntext";
            
case "numeric"return "SqlDbType.Numeric";
            
case "nvarchar"return "SqlDbType.Nvarchar";
            
case "nvarchar"return "SqlDbType.Nvarchar";
            
case "real"return "SqlDbType.Real";
            
case "smalldatetime"return "SqlDbType.Smalldatetime";
            
case "smallint"return "SqlDbType.Smallint";
            
case "smallmoney"return "SqlDbType.Smallmoney";
            
case "sql_variant"return "SqlDbType.Sql_variant";
            
case "text"return "SqlDbType.Text";
            
case "timestamp"return "SqlDbType.Timestamp";
            
case "tinyint"return "SqlDbType.Tinyint";
            
case "uniqueidentifier"return "SqlDbType.Uniqueidentifier";
            
case "varbinary"return "SqlDbType.Varbinary";
            
case "varbinary"return "SqlDbType.Varbinary";
            
case "varchar"return "SqlDbType.Varchar";
            
case "varchar"return "SqlDbType.Varchar";
            
case "xml"return "SqlDbType.Xml";
        }
posted on 2006-10-19 17:51  吴勇  阅读(524)  评论(2)    收藏  举报