有没有SQL数据类型转换为C#类型的现成方法
有时需要将SQl的数据类型和C#的数据类型相互转换,如将SqlDbType.Int转为C#的int,有没有现成办法,我现在是将各种sql类型都写出来,然后通过一个函数手工转换.
------解决方案--------------------没有
------解决方案--------------------貌似要自己根据值域映射
------解决方案--------------------SqlDbType.Int 
 和 
 int 
 除了空值本身就是一样的了. 
 你为什么要进行转换呢?什么情况下你要转换? 
------解决方案--------------------是要这个方法吗? 
         private string ParaChange(string s,int length) 
         { 
             switch (s) 
             { 
                 case  "int ": 
                     s= "Int "; 
                     break; 
                 case  "varchar ": 
                     s =  "VarChar,  " + length ; 
                     break; 
                 case  "bit ": 
                     s =  "Bit "; 
                     break; 
                 case  "datetime ": 
                     s =  "DateTime "; 
                     break; 
                 case  "decimal ": 
                     s =  "Decimal "; 
                     break; 
                 case  "float ": 
                     s =  "Float "; 
                     break; 
                 case  "image ": 
                     s =  "Image "; 
                     break; 
                 case  "money ": 
                     s =  "Money "; 
                     break; 
                 case  "ntext ": 
                     s =  "NText "; 
                     break; 
                 case  "nvarchar ": 
                     s =  "NVarChar "; 
                     break; 
                 case  "smalldatetime ": 
                     s =  "SmallDateTime "; 
                     break;  
                 case  "smallint ": 
                     s =  "SmallInt "; 
                     break; 
                 case  "text ": 
                     s =  "Text "; 
                     break; 
             } 
             return s; 
         }