title: How could I pass parameter to sqldataadapter?
body: <p>I have tried to pass parameter a value, but what it returns is nothing. If I use a simple sql command without parameter I can retrieve all the data from my database.
  Here is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Public Shared Function RetrieveData() As DataTable
      Connection.Open()
      Try
          sql = "SELECT DEP_ID AS CODE, DEP_NAME AS DEPARTMENT FROM DEPART_TBL WHERE " &amp; FieldName &amp; " LIKE N'%@criteria%'"
          da = New SqlDataAdapter
          da.SelectCommand = New SqlCommand(sql, Connection.SQLConnection)
          da.SelectCommand.Parameters.Add("@criteria", SqlDbType.NChar)
          da.SelectCommand.Parameters("@criteria").Value = "KCL"
          'da.SelectCommand.Parameters.Add("@criteria", SqlDbType.NChar, 10, "DEP_ID")
          'Message.ShowInfo(da.SelectCommand.CommandText.ToString)
          'Exit Function
          dt = New DataTable
          da.Fill(dt)
      Catch ex As Exception
          Message.ShowError(ex.Message)
      End Try
      da.Dispose()
      Connection.Close()
      Return dt
  End Function</code></pre>
  </div>
  </div>
  </p>