none
listview subitems RRS feed

  • Question

  • hi

    how to get the value of listview subitem.here is the code.

    i want to insert those values into database.

     for (int cnt = 0; cnt <=  ListView1_EPC.Items.Count-1; cnt++)
                             {



                                 String str = "insert into transaction(tag_id,category_id,product_id,product_name,gate_id,in_time,out_time,remarks)values('" + ListView1_EPC.Items[cnt].Text + "','" + ListView1_EPC.Items[cnt].SubItems[CategoryID.Index].Text + "','" + ListView1_EPC.Items[cnt].SubItems[ProductID.Index].Text + "','" + ListView1_EPC.Items[cnt].SubItems[ProductName.Index].Text + "','" + ListView1_EPC.Items[cnt].SubItems[GateID.Index].Text + "','" + ListView1_EPC.Items[cnt].SubItems[INTime.Index].Text + "','" + ListView1_EPC.Items[cnt].SubItems[OUTTime.Index].Text + "','" + ListView1_EPC.Items[cnt].SubItems[Remarks.Index].Text + "')";
    MySqlCommand cmd;


    MySqlConnection connection1 = new MySqlConnection(MyConnectionString);
    cmd = new MySqlCommand(str, connection1);
    connection1.Open();

    cmd.ExecuteNonQuery();// 
    Saturday, October 26, 2013 9:18 AM

All replies