title: Search database for substring based on user input using SQL
body: <p>I am doing a uni project where I need to search for a user from a database in Visual Studio 2010, based on their FirstName, SurName, EmailAddress or SkillSet using a SQL command in vb.net.</p>
  
  <p>So from the start...  The use registers and includes a skill set that is a single textbox that they type in the likes of "Java", "C#", etc.</p>
  
  <p>I can search for the everything fine, apart from the SkillSet if the user has more than one skill. </p>
  
  <p>I want to search for anything using "LIKE" in the SQL command.</p>
  
  <p>Here's what I have at the minute for searching for a user: </p>
  
  <p><strong>SQL command to select the details I want</strong></p>
  
  <pre><code>Dim command As New SqlCommand("SELECT [FirstName], [SurName], [EmailAddress], [SkillSet], [UserID] FROM [Users] WHERE ([FirstName] = @FirstName OR [SurName] = @SurName OR [EmailAddress] = @EmailAddress OR [SkillSet] LIKE '%' @SkillSet '%')", connection)
  </code></pre>
  
  <p><strong>Creating the Paramaters</strong></p>
  
  <pre><code>    Dim firstnameParam As New SqlParameter("@FirstName", Me.UserSearchTextBox.Text)
      Dim surnameParam As New SqlParameter("@SurName", Me.UserSearchTextBox.Text)
      Dim emailParam As New SqlParameter("@EmailAddress", Me.UserSearchTextBox.Text)
      Dim skillSetParam As New SqlParameter("@SkillSet", Me.UserSearchTextBox.Text)
  
      command.Parameters.Add(firstnameParam)
      command.Parameters.Add(surnameParam)
      command.Parameters.Add(emailParam)
      command.Parameters.Add(skillSetParam)`
  </code></pre>