Listview control in c#,mysql database RRS feed

  • Question

  • hi all,

    am using mysql table is inventory(tag_id varchar(30),category_id,product_id) all are varchar.

    in my application there is a listview .it is a UHFReader project.when reader reads the card ,card is only having tag_id .tag id is displayed in the tag_id column of the listView , based on the tag id (means at the database if tag_id mached with database tag_id ) other values like category_id,product_id sholud be displayed in the corresponding columns of listview.

    plz help me.........


    Tuesday, October 22, 2013 12:43 PM


  • Hi,

    From my understanding,I'm confused your said get tag_id and then based on the tag_id to get other value,could you give me some screenshots? if you want to display multiple columns from Database in ListView control, to get the desired effect, you should set the view style to Details and add the second and third column value as sub-item.
    You can refer the code below to implement your function:

    // Set display model as Details
    listView1.View = View.Details;
    // Add ListView Columns.
      listView1.Columns.Add("tag id");
    // read data from database.
      while (reader.Read())
          var item = new ListViewItem();
          item.Text = reader["tag_id "].ToString();        // 1st column text
          item.SubItems.Add(reader["category_id "].ToString());  // 2nd column text

    Regards & Thanks,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 23, 2013 11:26 AM