Browse Source

Queryable.AddParameters In Array bug

pull/1/head
skx 4 years ago
parent
commit
ff9b1d6f76
  1. 8
      Src/Asp.Net/SqlServerTest/UnitTest/UQueryable.cs
  2. 7
      Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs

8
Src/Asp.Net/SqlServerTest/UnitTest/UQueryable.cs

@ -129,6 +129,14 @@ namespace OrmTest
{
throw new Exception("Queryable");
}
Db.Insertable(new Order() { CreateTime=DateTime.Now, CustomId=1, Name="a",Price=1 }).ExecuteCommand();
var sa = Db.SqlQueryable<Order>("SELECT * FroM [ORDER] where id in (@id) ");
sa.AddParameters(new List<SugarParameter>() {
new SugarParameter("id",new int[]{ 1})
});
int i = 0;
var salist= sa.ToPageList(1,2,ref i);
}
/// <summary>

7
Src/Asp.Net/SqlSugar/Abstract/AdoProvider/AdoProvider.cs

@ -1374,7 +1374,14 @@ namespace SqlSugar
{
sql = sql.Replace("@" + item.ParameterName.Substring(1), newValues.ToArray().ToJoinSqlInVals());
}
if (item.ParameterName.Substring(0, 1) != this.SqlParameterKeyWord)
{
sql = sql.Replace(this.SqlParameterKeyWord+item.ParameterName, newValues.ToArray().ToJoinSqlInVals());
}
else
{
sql = sql.Replace(item.ParameterName, newValues.ToArray().ToJoinSqlInVals());
}
item.Value = DBNull.Value;
}
}

Loading…
Cancel
Save