title: Function to check if Input is in column in SQL Server database
body: <p>Okay, I'm creating an application which requires the user to input there Gamer-Tag during the registration process. Only 'Members' of a group may have access to the program and so I need the application to refuse anyone who's Gamer-Tag is <strong>not</strong> in the SQL Server database. </p>
  
  <p>I adapted a function I created to log-in with your details and changed it to check if the Gamer-Tag is on the database, but I'm receiving a strange error:</p>
  
  <blockquote>
    <p>The column 'Gamer_Tag' is not a Member of 'Members_Details' Table.</p>
  </blockquote>
  
  <p>Please note, that's an error and not what I am wanting it to do. It's saying the column 'Gamer_Tag' isn't in the table, but I know it is! I've checked spelling and spacing and everything's as it should be, so I'm assuming it's something wrong with the code.</p>
  
  <p>The (relevant) register button code:</p>
  
  <p>(Note, <code>RegUserName.Text</code> is the textbox that contains the users Gamer-Tag.</p>
  
  <pre><code> Dim dbManager As New DatabaseManager()
      If dbManager.CheckGamerTagisMember(RegUserName.Text) Then
          MsgBox("Gamer-Tag Not A Member.")
          My.Settings.RegisterCount = 1
          My.Settings.Save()
          RegisterBTN.Enabled = True
          MsgBox("Registration Failed.")
          GoTo Ender
      Else
          MsgBox("Gamer-Tag is A Member.")
          GoTo Ender
      End If
  </code></pre>
  
  <p>And the function this is calling:</p>
  
  <pre><code>Public Function CheckGamerTagisMember(ByVal gamertag As String) As Boolean
      Connection = New SqlConnection("Data Source =" &amp; My.Settings.ServerIP &amp; ";Initial Catalog=Members_Details;Integrated Security=False;User=" &amp; My.Settings.UserName &amp; ";Password=********;")
      Connection.Open()
      Dim gamertagDatSet As New DataSet()
      usersDataAdapter.FillSchema(gamertagDatSet, SchemaType.Source, "Members_Details")
      usersDataAdapter.Fill(gamertagDatSet, "Members_Details")
      Dim table As DataTable = gamertagDatSet.Tables("Members_Details")
  
      For i As Integer = 0 To table.Rows.Count - 1
          Dim currentUsergt As String = table.Rows(i)("Gamer_Tag").ToString.Trim()
          If (currentUsergt = gamertag) Then
              gamertagDatSet.Dispose()
              Connection.Close()
              Return True
          End If
      Next
  
      gamertagDatSet.Dispose()
      Connection.Close()
      Return False
  End Function
  </code></pre>
  
  <p>And to prove the column is in the table, here's the table's columns;</p>
  
  <p><img src="https://i.stack.imgur.com/k2a61.png" alt="enter image description here"></p>
  
  <p>I'm new to structuring my code into classes, so I could be 'passing' things around wrongly.</p>
  
  <p>Any help would be much appreciated! </p>