listview中数据读入数据库表中,怎么没反应啊?
SqlConnection XX=new SqlConnection(Xintong);
int Lh = listView1.Items.Count;
for (int j = 0; j < Lh; j++)
{
XX.Open();
String num = listView1.Items[j].SubItems[0].ToString();
String name = listView1.Items[j].SubItems[1].ToString();
String price = listView1.Items[j].SubItems[2].ToString();
String date = listView1.Items[j].SubItems[3].ToString();
String count = listView1.Items[j].SubItems[4].ToString();
String ch = listView1.Items[j].SubItems[5].ToString();
String Xql = "insert into 商品查询表 values('" + num + "','" + name + "','" + price + "','" + date + "','" + count + "','" + ch + "')";
SqlCommand XXcom = new SqlCommand(Xql, XX);
XX.Close();
}
我哪些错了?
------解决方案--------------------
少了一句执行语句
XXcom.ExcuteNOQuery()