0

这是我的代码。我正在尝试使用此 MyResponses() 插入数据。这是我的下一个点击事件。

    nextclick event
{
      Section surveySection = DataAccess.AccessSurveySectionByParameters(currentSurvey.EmplID, currentSurvey.UnitId, currentSurvey.SurveyId, currentSurvey.Sort.ToString(), NextStep, GetSurveyResponses());
      PopulateSurveySection(currentSurvey, surveySection);
}

private string MyResponses()
{
    string resp = "";

    foreach (Control ctr in pnlSurveySection.Controls)
    {
        if (ctr is Table)
        {

            Table tbl = ctr as Table;

                foreach (TableRow tr in tbl.Rows)
                {
                    string sres = "";
                    string currid = tr.Cells[0].Attributes["ID"];
                    TableCell tc = tr.Cells[1];
                    if(currid.StartsWith("editable"))
                    {
                        currid.Substring(0, 14);
                    foreach (Control ctrc in tc.Controls)
                    {

                        if (ctrc is TextBox)
                        {
                            sres = currid + "||" + (ctrc as TextBox).Text.Trim();
                        }
                        else if (ctrc is RadioButtonList)
                        {
                            sres = currid + "||" + (ctrc as RadioButtonList).SelectedValue;
                        }
                        else if (ctrc is DropDownList)
                        {
                            sres = currid + "||" + (ctrc as DropDownList).SelectedValue;
                        }
                        else if (ctrc is CheckBoxList)
                        {
                            sres = currid + "||" + (ctrc as CheckBoxList).SelectedItem.ToString() + "|";
                        }

                    }
                    }
                    resp = resp + (string.IsNullOrEmpty(resp) ? "|||" : "") + sres;
                }

            }

它不是插入数据。并且没有给我任何错误..任何建议表示赞赏

谢谢

4

0 回答 0