相关疑难解决方法(0)

逗号附近的语法不正确

这是我尝试从会话中获取多个值时的ASPX代码段.我收到一个错误:"逗号附近的语法不正确"(标记在代码段中的行):

SqlCommand cmd1 = new SqlCommand("select plugin_id from profiles_plugins where profile_id=" + Convert.ToInt32(Session["cod"]), con);
        SqlDataReader dr1 = cmd1.ExecuteReader();
        var yourlist =new List<Int32>();
        if (dr1.HasRows)
        {
            while (dr1.Read())
            {
                yourlist.Add(Convert.ToInt32(dr1[0]));
            }
        }

        //String str1 = String.Join(", ", yourlist.Select(o => o.ToString()).ToArray());
            dr1.Close();
        cmd1.Dispose();
        Array k= yourlist.ToArray();
        Int32 a =Convert.ToInt32( k.GetValue(0));
        Int32 b =Convert.ToInt32( k.GetValue(1));
        Int32 c =Convert.ToInt32( k.GetValue(2));
        Int32 d =Convert.ToInt32( k.GetValue(3));
        SqlCommand cmd2 = new SqlCommand("select id,name from plugins where id =(" + a + " or " + b + …
Run Code Online (Sandbox Code Playgroud)

sql asp.net

3
推荐指数
1
解决办法
1079
查看次数

标签 统计

asp.net ×1

sql ×1