title: Creating Search Function in asp.net
body: <p>I am trying to make search function in my web application.</p>
  
  <p>Basically, i have one <code>text box</code> and one <code>button</code>. 
  Also i have <code>listbox</code> to render the search results.</p>
  
  <p>I am using follwing query on access which is returning nothing.</p>
  
  <pre><code>SELECT [identifier] FROM [Category3]
  WHERE [identifier] LIKE '%' + @name + '%';
  </code></pre>
  
  <p>The value for <code>@name</code> comes from the <code>text box</code>.</p>
  
  <p>I am looking to search only one column of the table, so i will like to render the return results to the <code>list box</code>.</p>
  
  <p>Do i need to use DataSet to store and render the results.</p>
  
  <p>Any advice will be appreciated.</p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code> protected void Button1_Click(object sender, EventArgs e)
          {
              searchDB(TextBox1.Text);
  
          }
  
  
  
  public DataSet searchDB(string identifier)
          {
              DataSet dataSet = new DataSet();
              // Create connection object
              OleDbConnection oleConn = new OleDbConnection(connString);
              try
              {
                  oleConn.Open();
                  string sql = "SELECT [identifier] WHERE [identifier] LIKE '% + @name + %'";
  
                  OleDbCommand oleComm = new OleDbCommand(sql, oleConn);
                  oleComm.Parameters.Add("@name", OleDbType.Char).Value = identifier;
  
                  OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sql, oleConn);
                  dataAdapter.Fill(dataSet, "Category3");
              }
              catch (Exception ex)
              {
                  Response.Redirect("Error.aspx");
              }
              finally
              {
                  oleConn.Close();
              }
              if (dataSet.Tables.Count &lt;= 0)
                  return null;
              else
                  return dataSet;
          }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/HcTxj.jpg" alt="enter image description here"></p>