C # the SQL float type is operated, and the data will contain many decimal places. Originally, the float type of C # is different from the float type of SQL.
/// <Summary>
/// Compare the data types in the database with those in C #
/// </Summary>
/// <Param name = "type"> </param>
/// <Returns> </returns>
Private string changetocsharptype (string type)
{
String reval = string. empty;
Switch (type. tolower ())
{
Case "int ":
Reval = "int32 ";
Break;
Case "text ":
Reval = "string ";
Break;
Case "bigint ":
Reval = "int64 ";
Break;
Case "binary ":
Reval = "system. byte []";
Break;
Case "bit ":
Reval = "Boolean ";
Break;
Case "char ":
Reval = "string ";
Break;
Case "datetime ":
Reval = "system. datetime ";
Break;
Case "decimal ":
Reval = "system. Decimal ";
Break;
Case "float ":
Reval = "system. Double ";
Break;
Case "image ":
Reval = "system. byte []";
Break;
Case "money ":
Reval = "system. Decimal ";
Break;
Case "nchar ":
Reval = "string ";
Break;
Case "ntext ":
Reval = "string ";
Break;
Case "numeric ":
Reval = "system. Decimal ";
Break;
Case "nvarchar ":
Reval = "string ";
Break;
Case "real ":
Reval = "system. Single ";
Break;
Case "smalldatetime ":
Reval = "system. datetime ";
Break;
Case "smallint ":
Reval = "int16 ";
Break;
Case "smallmoney ":
Reval = "system. Decimal ";
Break;
Case "timestamp ":
Reval = "system. datetime ";
Break;
Case "tinyint ":
Reval = "system. Byte ";
Break;
Case "uniqueidentifier ":
Reval = "system. guid ";
Break;
Case "varbinary ":
Reval = "system. byte []";
Break;
Case "varchar ":
Reval = "string ";
Break;
Case "variant ":
Reval = "object ";
Break;
Default:
Reval = "string ";
Break;
}
Return reval;
}