Browse Source

Update SqlServerProvider

pull/19/head
sunkaixuan 2 years ago
parent
commit
5b3977cbd4
  1. 25
      Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlServerProvider.cs

25
Src/Asp.Net/SqlSugar/Realization/SqlServer/SqlServerProvider.cs

@ -131,7 +131,7 @@ namespace SqlSugar
sqlParameter.UdtTypeName = parameter.UdtTypeName; sqlParameter.UdtTypeName = parameter.UdtTypeName;
sqlParameter.Size = parameter.Size; sqlParameter.Size = parameter.Size;
sqlParameter.Value = parameter.Value; sqlParameter.Value = parameter.Value;
sqlParameter.DbType = parameter.DbType; sqlParameter.DbType = GetDbType(parameter);
var isTime = parameter.DbType == System.Data.DbType.Time; var isTime = parameter.DbType == System.Data.DbType.Time;
if (isTime) if (isTime)
{ {
@ -157,7 +157,8 @@ namespace SqlSugar
} }
sqlParameter.Direction = parameter.Direction; sqlParameter.Direction = parameter.Direction;
result[index] = sqlParameter; result[index] = sqlParameter;
if (parameter.TypeName.HasValue()) { if (parameter.TypeName.HasValue())
{
sqlParameter.TypeName = parameter.TypeName; sqlParameter.TypeName = parameter.TypeName;
sqlParameter.SqlDbType = SqlDbType.Structured; sqlParameter.SqlDbType = SqlDbType.Structured;
sqlParameter.DbType = System.Data.DbType.Object; sqlParameter.DbType = System.Data.DbType.Object;
@ -178,5 +179,25 @@ namespace SqlSugar
} }
return result; return result;
} }
private static System.Data.DbType GetDbType(SugarParameter parameter)
{
if (parameter.DbType==System.Data.DbType.UInt16)
{
return System.Data.DbType.Int16;
}
else if (parameter.DbType == System.Data.DbType.UInt32)
{
return System.Data.DbType.Int32;
}
else if (parameter.DbType == System.Data.DbType.UInt64)
{
return System.Data.DbType.Int32;
}
else
{
return parameter.DbType;
}
}
} }
} }

Loading…
Cancel
Save