使用checkedListbox控件,里面有“维护、修改、编辑、下载、导出”五个选项,如何使用二进制方法把选中的值存储到数据库中,控件数据库

解决方案 »

  1.   

    其实就是转换成byte数组。 
    string   str   =   "字符串"  ;  
      byte[]   bytes   =   System.Text.Encoding.ASCII.GetBytes(str); 
    string r=""; 
    for(int i=0;i<bytes.Length;i++)
    {
       r+=bytes[i]+" ";//已空格隔开二进制流
    }
    然后把r存到数据库不就行了
      

  2.   

    checkedListBox1.Items.Add("aa");  
    checkedListBox1.Items.Add("bb");
    checkedListBox1.Items.Add("cc"); 
    string str;
    for (int j = 0; j < checkedListBox1.Items.Count; j++) 
    {
     if(checkedListBox1.GetItemChecked(j))                 
    {    str+=checkedListBox1.SelcetTextValue;              
     }  
      
       byte[]   bytes   =   System.Text.Encoding.ASCII.GetBytes(str); 
     string b=""; 
     for(int i=0;i<bytes.Length;i++)
     {
        b+=bytes[i]+" ";//已空格隔开二进制流

    protected void Button1_Click(object sender, EventArgs e)      {          for(int i=0;i<=this.CheckBoxList1.Items.Count-1;i++)          {              if(this.CheckBoxList1.Items[i].Selected)              {                  Response.Write(this.CheckBoxList1.Items[i].Value.ToString() +"-"+this.CheckBoxList1.Items[i].Text + "");              }          }      } 
    手上没有编译器,不知道做的怎样,楼主自己参考吧!