private string Convert2CsharpType(string type)
{
string strVal=string.empty;
switch(type.tolower())
{
case "int":
strVal= "int32 ";
break;
case "text":
strVal= "string ";
break;
case "bigint":
strVal= "int64 ";
break;
case "binary":
strVal= "system.byte[] ";
break;
case "bit":
strVal= "boolean ";
break;
case "char":
strVal= "string ";
break;
case "datetime ":
strVal= "system.datetime ";
break;
case "decimal":
strVal= "system.decimal ";
break;
case "float":
strVal= "system.double ";
break;
case "image":
strVal= "system.byte[] ";
break;
case "money":
strVal= "system.decimal ";
break;
case "nchar":
strVal= "string ";
break;
case "ntext":
strVal= "string ";
break;
case "numeric":
strVal= "system.decimal ";
break;
case "nvarchar":
strVal= "string ";
break;
case "real":
strVal= "system.single ";
break;
case "smalldatetime ":
strVal= "system.datetime ";
break;
case "smallint":
strVal= "int16 ";
break;
case "smallmoney":
strVal= "system.decimal ";
break;
case "timestamp":
strVal= "system.datetime ";
break;
case "tinyint":
strVal= "system.byte ";
break;
case "uniqueidentifier ":
strVal= "system.guid ";
break;
case "varbinary":
strVal= "system.byte[] ";
break;
case "varchar":
strVal= "string ";
break;
case "variant":
strVal= "object ";
break;
default:
strVal= "string ";
break;
}
return strVal;
}
Sql Server与c#之间数据类型对应
最新推荐文章于 2024-05-24 19:34:51 发布