title: take data from sql database and add to list view colum?
body: <p>i'm C# programmer i have tried to add sql database data to my list view but it occurs error (cannot add or insert in the same place)</p>
  
  <pre><code>ListViewItem i = new ListViewItem();
  Invoke(new Action(() =&gt; listBox1.Items.Clear()));
  con = new SqlConnection("Data Source=LEO-PC\\SQLEXPRESS;Initial Catalog = Datashare;Integrated Security = True");
  cmd = new SqlCommand("select * from shareTable", con);
  con.Open();
  SqlDataReader sqlRead;
  try
  {
      sqlRead = cmd.ExecuteReader();
      while (sqlRead.Read())
      {
  
          string fileNameStr = (string)sqlRead["filePath"];
          string author = (string)sqlRead["authorName"];
          DateTime uploadTime = (DateTime)sqlRead["dateSend"];
          string date = Convert.ToString(uploadTime); ;
  
  
          Invoke(new Action(() =&gt; i.SubItems.Add(author)));
          Invoke(new Action(() =&gt; i.SubItems.Add(fileNameStr)));
          Invoke(new Action(() =&gt; i.SubItems.Add(date)));
          listView1.Items.Add(i);
      }
  }
  catch (Exception ex)
  {
      MessageBox.Show(ex.Message);
  }
  finally
  {
      con.Close();
  }
  </code></pre>