title: Any way to pass a SqlParameter from one class to another?
body: <p>I have a class, <strong>LogRequest</strong>, which contains parameters (members) for an object.<br>
  This object is turned to an sql query using another class, <strong>DataAccess</strong>.<br>
  And lastly, I have the class <strong>Search</strong> which run the sql query.</p>
  
  <p>In Search : </p>
  
  <pre><code>'Create the request
  Dim myRequest As LogRequest = MakeRequest()
  'Does the SQL query part
  responseList = DataAccess.ReadLogs(myRequest)
  </code></pre>
  
  <p>My problem is that the <strong>Where</strong> part is built up ("x=1","b=2","date between x and y"...) in LogRequest. </p>
  
  <p>In DataAccess : </p>
  
  <pre><code>' request is a LogRequest object  
  For Each filter As String In request.GetFilters()
      sqlfilters.AppendLine(String.Format("{0} {1}", IIf(first, "WHERE", "AND"), filter))
      first = False
  Next
  sql = String.Format("SELECT * FROM table_x {0} ", sqlfilters)    
  </code></pre>
  
  <p>Any suggestions on how I could break those strings to use sqlParameters instead?  </p>
  
  <p>Is this a design issue, should I move the "GetFilters" part to the dataAccess class?</p>
  
  <h2>Edit:</h2>
  
  <p>Also, any suggestions on how to pass sqlParameters from a function to another would be appreciated. (The second one creating and handling the command.)</p>