国内vps的sql中in的参数怎么注入
为wherein的每一个参数生成一个参数,代码如下:
using(SqlConnectionconn=newSqlConnection(connectionString))
{
conn.Open();
SqlCommandcomm=newSqlCommand();
comm.Connection=conn;
//为每一条数据添加一个参数
comm.CommandText="select*fromUsers(nolock)whereUserIDin(@UserID1,@UserId2,@UserID3,@UserID4)";
comm.Parameters.AddRange(
newSqlParameter[]{
newSqlParameter("@UserID1",SqlDbType.Int){Value=1},
newSqlParameter("@UserID2",SqlDbType.Int){Value=2},
newSqlParameter("@UserID3",SqlDbType.Int){Value=3},
newSqlParameter("@UserID4",SqlDbType.Int){Value=4}
});
comm.ExecuteNonQuery();
}
购买使用一诺网络国内vps,可以极大降低初创企业、中小企业以及个人开发者等用户群体的整体IT使用成本,无需亲自搭建基础设施、简化了运维和管理的日常工作量,使用户能够更专注于自身的业务发展和创新。国内VPS低至69元/月,购买链接:https://www.enuoidc.com/vpscn.html?typeid=5