代码如下:我选中checkboxlist后,只能往数据库里添加15人汉字,多余了,就自动去掉了,我没有限制字数啊,这是为什么啊?
        ///获取检验医技cheboxlist的内容                
                     StringBuilder sb1 = new StringBuilder();                     for (int i = 0; i < CheckBoxList2.Items.Count; i++)                         if (CheckBoxList2.Items[i].Selected)
                         {                             sb1.Append((CheckBoxList2.Items[i]).Text);
                             sb1.Append(",");                         }
        ///获取checkboxlist3的值                     for (int i = 0; i < CheckBoxList3.Items.Count; i++)
                         if (CheckBoxList3.Items[i].Selected)
                         {                             sb1.Append((CheckBoxList3.Items[i]).Text);
                             sb1.Append(",");                         }

解决方案 »

  1.   

    使用sqlparamter时指定了长度??????????
    这个可能性比较大
      

  2.   

    如果数据训是Varchar(15)那么改成Nvarchar(15)就可以了.
      

  3.   

    这是有关的全部代码
      protected void btn_y_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();        for (int i = 0; i < CheckBoxList1.Items.Count; i++)            if (CheckBoxList1.Items[i].Selected)
                {                sb.Append((CheckBoxList1.Items[i]).Text);
                    sb.Append(",");
                    //Session["s_aids"] = sb;
                         }
            ///获取检验医技cheboxlist的内容
                     if (DropDownList2.SelectedValue=="检验医技")
                     {
                         StringBuilder sb1 = new StringBuilder();                     for (int i = 0; i < CheckBoxList2.Items.Count; i++)                         if (CheckBoxList2.Items[i].Selected)
                             {                             sb1.Append((CheckBoxList2.Items[i]).Text);
                                 sb1.Append(",");                         }
                             else
                             {                             Jscript.Alert("请输入您的值");
                             
                             }
                    }
            ///获取checkboxlist3的值
                                         for (int i = 0; i< CheckBoxList3.Items.Count; i++)
                             if (CheckBoxList3.Items[i].Selected)
                             {                             sb1.Append((CheckBoxList3.Items[i]).Text);
                                 sb1.Append(",");                         }                                                                         for (int i = 0; i < CheckBoxList4.Items.Count; i++)                         if (CheckBoxList4.Items[i].Selected)
                             {
                                 sb1.Append((CheckBoxList4.Items[i]).Text);
                                 sb1.Append(",");                         }                 
                                            for (int i = 0; i < CheckBoxList5.Items.Count; i++)
                             if (CheckBoxList5.Items[i].Selected)
                             {
                                 sb1.Append((CheckBoxList5.Items[i].Text));
                                 sb1.Append(",");                         }
                                  
                        
                          for (int i = 0; i < CheckBoxList6.Items.Count; i++)                         if (CheckBoxList6.Items[i].Selected)
                             {
                                 sb1.Append((CheckBoxList6.Items[i].Text));
                                 sb1.Append(",");
                             }                      
            int s_image = 1;                             try
            {
                           //string s_qiyu = Convert.ToString(Session["s_aids"]);            bool result = (new Member_all()).Mhickey_insert(txt_name.Text.Trim(), DropDownList1.SelectedValue, sb.ToString().Trim(), DropDownList2.SelectedValue, sb1.ToString(), txt_xinghao.Text.Trim(), txt_shuliang.Text, txt_dianjia.Text, txt_changshang.Text, txt_shouming.Text.Trim(), s_image, txt_yiaoqiu.Text.Trim(), txt_zhichi.Text.Trim());
                if (result == false)
                {                Jscript.Alert("请稍后注册");            }            else            {                Jscript.AlertAndRedirect("添加成功","Mhickey_issue.aspx");
                
                }
            
            
            
            
            }
            catch(System.Data.SqlClient.SqlException ex)
            {            throw new Exception(ex.Message);
            }
        }
        /// <summary>
        ///  
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
        {        if (DropDownList2.SelectedValue == "检验医技")
            {
               
                CheckBoxList2.Visible = true;
                Panel2.Visible = false;
                Panel3.Visible = false;
                Panel4.Visible = false;
                Panel5.Visible = false;        
             }
             if (DropDownList2.SelectedValue == "基础设备")
             {
                
                 Panel2.Visible = true;
                 Panel3.Visible = false;
                 Panel4.Visible = false;
                 Panel5.Visible = false;
                      }         if (DropDownList2.SelectedValue == "手术治疗")
             {
                
                 Panel2.Visible = false;
                 Panel3.Visible = true;
                 Panel4.Visible = false;
                 Panel5.Visible = false;
             }         if (DropDownList2.SelectedValue == "监测护理")
             {
               
                 Panel2.Visible = false;
                 Panel3.Visible = false;
                 Panel4.Visible = true;
                 Panel5.Visible = false;
             }
             if (DropDownList2.SelectedValue == "家用医疗")
             {
                
                 Panel2.Visible = false;
                 Panel3.Visible = false;
                 Panel4.Visible = false;
                 Panel5.Visible = true;
             }   }
      

  4.   

    Member_all.Mhickey_insert
    中如果指定参数类型为ntext
     则不要同时指定其长度为16
    ntext(16)存放的是指针不是数据块
      

  5.   

    Member_all.Mhickey_insert
    中如果指定参数类型为ntext
     则不要同时指定其长度为16
    ntext(16)存放的是指针不是数据块
      

  6.   

    其是能过blackant2(乔峰)老兄一指,小弟,已经明白几分,加分