Posted on 2006-06-15
I can get this to insert 'this is a test' and that works fine.
But how should I get it to insert the data that Im showing in the MessageBox in the foreach loop?
SqlConnection sqlConn = new SqlConnection();
sqlConn.ConnectionString = "Data Source=PC001;Initial Catalog=mytest;Integrated Security=True;";
string insertString = @"insert into websites (website) values ('This is a test')";
SqlCommand cmd = new SqlCommand(insertString, sqlConn);
foreach (string listBoxItem in listBox1.Items)
MessageBox.Show("saving " + listBoxItem.Trim().ToString());