private string ChangeToCSharpType(string type)
{
string reval = string.Empty;
switch (type.ToLower())
{
case "int":
reval = "Int32"; // int
break;
case "text":
reval = "String"; // string
break;
case "bigint":
reval = "Int64"; // long
break;
case "binary":
reval = "System.Byte[]"; // byte[]
break;
case "bit":
reval = "Boolean"; // bool
break;
case "char":
reval = "String"; // string
break;
case "datetime":
reval = "System.DateTime";
break;
case "decimal":
reval = "System.Decimal"; // decimal
break;
case "float":
reval = "System.Double"; // double
break;
case "image":
reval = "System.Byte[]"; // byte[]
break;
case "money":
reval = "System.Decimal"; // decimal
break;
case "nchar":
reval = "String";
break;
case "ntext":
reval = "String";
break;
case "numeric":
reval = "System.Decimal"; // decimal
break;
case "nvarchar":
reval = "String";
break;
case "real":
reval = "System.Single"; // float
break;
case "smalldatetime":
reval = "System.DateTime";
break;
case "smallint":
reval = "Int16"; // short
break;
case "smallmoney":
reval = "System.Decimal"; // decimal
break;
case "timestamp":
reval = "System.DateTime";
break;
case "tinyint":
reval = "System.Byte"; // byte
break;
case "uniqueidentifier":
reval = "System.Guid";
break;
case "varbinary":
reval = "System.Byte[]"; // byte[]
break;
case "varchar":
reval = "String"; // string
break;
case "Variant":
reval = "Object"; // object
break;
default:
reval = "String"; // string
break;
}
return reval;
}
http://www.pcvc.net/category/6.html