Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. ERROR MESSAGE

ERROR MESSAGE

Scheduled Pinned Locked Moved Visual Basic
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3672257
    wrote on last edited by
    #1

    I get an error > Line 1: Incorrect syntax near 'Username' When i run the code below hdstr = "SELECT Password FROM LogIn WHERE Username='" & UsernameTextBox.Text & "'" hdcmd = New SqlCommand(hdstr, hdcon) hdcmd.Parameters.Add(New SqlParameter("Username", UsernameTextBox.Text)) Dim usr As String = hdcmd.ExecuteScalar() Please help. JESA

    P 1 Reply Last reply
    0
    • U User 3672257

      I get an error > Line 1: Incorrect syntax near 'Username' When i run the code below hdstr = "SELECT Password FROM LogIn WHERE Username='" & UsernameTextBox.Text & "'" hdcmd = New SqlCommand(hdstr, hdcon) hdcmd.Parameters.Add(New SqlParameter("Username", UsernameTextBox.Text)) Dim usr As String = hdcmd.ExecuteScalar() Please help. JESA

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      hdstr = "SELECT Password FROM LogIn WHERE Username= @UserName"

      hdcmd = New SqlCommand(hdstr, hdcon)
      hdcmd.Parameters.Add(New SqlParameter("@Username", UsernameTextBox.Text))

      Dim usr As String = hdcmd.ExecuteScalar()

      U 1 Reply Last reply
      0
      • P Paddy Boyd

        hdstr = "SELECT Password FROM LogIn WHERE Username= @UserName"

        hdcmd = New SqlCommand(hdstr, hdcon)
        hdcmd.Parameters.Add(New SqlParameter("@Username", UsernameTextBox.Text))

        Dim usr As String = hdcmd.ExecuteScalar()

        U Offline
        U Offline
        User 3672257
        wrote on last edited by
        #3

        Thank You. It worked. JESA

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups