• ADADADADAD

    sql中in的参数怎么注入[ 建站问答 ]

    建站问答 时间:2024-12-01 19:12:30

    作者:文/会员上传

    简介:

    sql中in的参数注入示例:为where in的每一个参数生成一个参数,代码如下:using (SqlConnection conn = new SqlConnection(connectionString)){conn.Open();SqlCommand comm = ne

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    sql中in的参数注入示例:

    为where in的每一个参数生成一个参数,代码如下:

    using (SqlConnection conn = new SqlConnection(connectionString))

    {

    conn.Open();

    SqlCommand comm = new SqlCommand();

    comm.Connection = conn;

    //为每一条数据添加一个参数

    comm.CommandText = "select * from Users(nolock) where UserID in (@UserID1,@UserId2,@UserID3,@UserID4)";

    comm.Parameters.AddRange(

    new SqlParameter[]{

    new SqlParameter("@UserID1", SqlDbType.Int) { Value = 1},

    new SqlParameter("@UserID2", SqlDbType.Int) { Value = 2},

    new SqlParameter("@UserID3", SqlDbType.Int) { Value = 3},

    new SqlParameter("@UserID4", SqlDbType.Int) { Value = 4}

    });

    comm.ExecuteNonQuery();

    }

    sql中in的参数怎么注入.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: sql注入in参数