The correspondence between SQL Server and C # data types in C #

xiaoxiao2021-03-06  69

///

/ / / Database in the database with the C #

///

///

///

Private string ChangeToCsharPType (String Type)

{

String rema = 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": rema = "system.byte []";

Break;

Case "varchar":

REVAL = "string";

Break;

Case "Variant":

REVAL = "Object";

Break;

DEFAULT:

REVAL = "string";

Break;

}

Return Reval;

}

转载请注明原文地址:https://www.9cbs.com/read-119909.html

New Post(0)