title: SQLDataSource: Running the select command multiple times with changing parameter (or array parameters?)
body: <p>I'm currently running a VB.net/ASPX web app that grabs specific records from a database depending upon a users security group level. What I want to do is if the user is from multiple security groups - to grab reports for each security group they exist in.</p>
  
  <p>In the where clause, this line exists:
  <code>and b.security_level_id = @security_level_id</code></p>
  
  <p>This only allows for one <code>security_level_id</code> to be passed into the select query.</p>
  
  <p>Is it possible to run the query multiple times, changing the parameter:</p>
  
  <p><code>&lt;asp:Parameter DefaultValue="0" Name="security_level_id" /&gt;</code></p>
  
  <p>or can I make an array out of this parameter and loop through it in a single query?</p>
  
  <p>Thanks!</p>
  
  <p>SOLVED:</p>
  
  <p>Ok. I Solved this issue by creating the select command in my actual VB code.. It removed the need for parameters so I could pass variables directly into the query string. </p>
  
  <p>I used:
   Protected Sub SqlDS_ReportCategories_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles SqlDS_ReportCategories.Init</p>
  
  <p>to get a handle on my data source, followed by:
  Dim s As SqlDataSource = CType(sender, SqlDataSource)
  To create an object reference of it.</p>
  
  <p>then 
  s.SelectCommand ="some query" + Variable + "rest of query"</p>
  
  <p>Hope this helps people in the future!</p>
  
  <ul>
  <li>Mat</li>
  </ul>