日期:2014-05-18 浏览次数:20801 次
string strValue = ""; for(int i = 0; i < this.listBox1.Items.Count; i++) { strValue += this.listBox1.Items[i].ToString(); } this.textBox1.Text = strValue;
------解决方案--------------------
string s = ""; for(int i=0;i<listBox1.Items.Count;i++) { s += listBox1.Items[i].ToString(); } textbox.Text = s;
------解决方案--------------------
SqlConnection con = new SqlConnection("Data Source=xxx;DataBase=ycw;User ID=sa;PWD=sa"); con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into tablename(col) values(@value)"; cmd.Parameters.AddWithValue("@value", this.textbox.Text); cmd.ExecuteNonQuery(); con.Close();