title: Populate listview with data received from SQL query
body: <p>I am currently trying to populate a listview with some data I have pulled from my database table; but not sure where to start; I have tried the following:</p>
  
  <pre><code>lstData.DataSource = conn;
  lstData.DataBind();
  </code></pre>
  
  <p>But that causes an error:</p>
  
  <blockquote>
    <p>"Data source is an invalid type. It must be either an IListSource,
    IEnumerable, or IDataSource. MVC"</p>
  </blockquote>
  
  <p>Am I using the correct query strings in order to populate my listview?</p>
  
  <p>Thanks,</p>
  
  <p>Callum</p>
  
  <p>C# Code:</p>
  
  <pre><code>string ssConnectionString = "Server connection";
  SqlConnection conn = new SqlConnection(ssConnectionString);
  conn.Open();
  
  SqlCommand command = conn.CreateCommand();
  command.CommandText = "SELECT Category FROM [dbo].[Category] WHERE CategoryID = '16'";            
  
  command.ExecuteNonQuery();          
  
  string com = command.ExecuteScalar().ToString();
  lblSQL.Text = com;
  conn.Close();
  </code></pre>