如果 我函数传过来一个 List<SqlParameter>,我想 把他拼接成
Sqlparameter[] ,因为 用的SQLHelper?

解决方案 »

  1.   

    Sqlparameter[] sqlParams=new Sqlparameter[list.count];
    sqlParams[1]=list[1];
    .....
      

  2.   

    不知道你要实现什么样的。以前我做过这样的。
    public void CommitAnswer(string level)
            {
                //取权限
                //BLL.T_Admin.Ht_Level = new BLL.T_Admin().GetPageInfo();
                //返回变量
                bool R_flag = false;
                //员工ID
                string E_id = TES.Common.Helper.Encrypt.ConvertInt(TES.Common.Helper.Encrypt.UrlDecode(Request.QueryString["ID"].ToString()));
                //得出答案
                List<double> LtAmswer = new List<double>();
                List<double> LtQuestionValue = new List<double>();
                for (int i = 0; i < this.rpQuestion.Items.Count; i++)
                {
                    RadioButtonList rdbtn = this.rpQuestion.Items[i].FindControl("rbtList_Question") as RadioButtonList;
                    for (int j = 0; j < rdbtn.Items.Count; j++)
                    {
                        if (rdbtn.Items[j].Selected)
                        {
                            LtAmswer.Add(TES.Common.Helper.ConvertHelper.ToDouble(rdbtn.Items[j].Value));
                        }
                    }
                    //加问题的权重
                    LtQuestionValue.Add(TES.Common.Helper.ConvertHelper.ToDouble((this.rpQuestion.Items[i].FindControl("HiddenValue") as HiddenField).Value));
                }
                //判断权限进行提交            R_flag = iemployee.TeacherApp_add(Session["LoginID"].ToString(), E_id, level, LtAmswer, LtQuestionValue);
                if (R_flag)
                {
                    TES.Common.WebHelper.JScript.AlertAndRedirect("投票完毕", Ht_PageInfo.Rows[0]["PageUrl"].ToString());
                    //this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('投票完毕');history.go(-2);self.location.reload();</script>");
                }
                else
                {
                    TES.Common.WebHelper.JScript.AlertAndRedirect("数据库出错,请联系管理员", Ht_PageInfo.Rows[0]["PageUrl"].ToString());
                    //this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('数据库出错,请联系管理员');history.go(-2);self.location.reload();</script>");
                }
            }
      

  3.   

    2楼回答是否正确
    Sqlparameter[] sqlParams=new Sqlparameter[list.count];
    sqlParams[1]=list[1];
      

  4.   

    arrSQLParams.ToArray();就可以了
      

  5.   

    大小不固定什么意思 用count实现 不管他里面有几项内容!
      

  6.   

     List<SqlParameter>,本质不就是一个数组吗?