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. SQL Error

SQL Error

Scheduled Pinned Locked Moved Visual Basic
databasecomhelpquestion
4 Posts 3 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.
  • P Offline
    P Offline
    Pasan148
    wrote on last edited by
    #1

    I am getting a syntax error in this SQL statement. But i can't figure out what it is. Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)" Whole code segment is below Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)" Dim com As New OleDb.OleDbCommand com.Parameters.Add("@User", OleDb.OleDbType.Char).Value = txtUser.Text com.Parameters.Add("@Pass", OleDb.OleDbType.Char).Value = txtpass.Text com.Parameters.Add("@Complete", OleDb.OleDbType.Char).Value = txtcomplete.Text com.Parameters.Add("@admin", OleDb.OleDbType.Char).Value = isadm what is the error of SQL statement.

    L D 2 Replies Last reply
    0
    • P Pasan148

      I am getting a syntax error in this SQL statement. But i can't figure out what it is. Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)" Whole code segment is below Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)" Dim com As New OleDb.OleDbCommand com.Parameters.Add("@User", OleDb.OleDbType.Char).Value = txtUser.Text com.Parameters.Add("@Pass", OleDb.OleDbType.Char).Value = txtpass.Text com.Parameters.Add("@Complete", OleDb.OleDbType.Char).Value = txtcomplete.Text com.Parameters.Add("@admin", OleDb.OleDbType.Char).Value = isadm what is the error of SQL statement.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      When the syntax error isn't obvious, most often it is due to a field name matching a keyword; the remedy is to put them all inside square brackets. As in [password]. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      P 1 Reply Last reply
      0
      • P Pasan148

        I am getting a syntax error in this SQL statement. But i can't figure out what it is. Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)" Whole code segment is below Dim sql As String = "INSERT INTO Users (UserID, Password, CompleteName, Admin) VALUES (@User, @Pass, @Complete, @admin)" Dim com As New OleDb.OleDbCommand com.Parameters.Add("@User", OleDb.OleDbType.Char).Value = txtUser.Text com.Parameters.Add("@Pass", OleDb.OleDbType.Char).Value = txtpass.Text com.Parameters.Add("@Complete", OleDb.OleDbType.Char).Value = txtcomplete.Text com.Parameters.Add("@admin", OleDb.OleDbType.Char).Value = isadm what is the error of SQL statement.

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        Are you missing this statement ?

        com.commandText = SQL

        1 Reply Last reply
        0
        • L Luc Pattyn

          When the syntax error isn't obvious, most often it is due to a field name matching a keyword; the remedy is to put them all inside square brackets. As in [password]. :)

          Luc Pattyn [My Articles] Nil Volentibus Arduum

          P Offline
          P Offline
          Pasan148
          wrote on last edited by
          #4

          It's working. thanks a lot. :)

          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