怎麼樣把listBox裡面的值插入到數據庫並且用分號隔開 清高手幫忙。。

解决方案 »

  1.   

    InsertInto db(name)values(lb.SelectValued.ToString());//类似这样,你自己再调试下
      

  2.   

    如果是多值,可以循环取选中的值
    for(int i=0; i<ListBox1.Rows-1; i++)
    {
    if(ListBox1.Items[i].Selected)
    {
    ...
    }
    }
      

  3.   

    string str = "";
            if (ListBox1.Rows >= 1)
            {
                for (int i = 0; i < ListBox1.Rows - 1; i++)
                {
                    str += ListBox1.Items[i].Text + ",";            }
                str = str.Substring(0, str.Length - 1);        }
            else
            {
                str = "";
            }