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. insert statment

insert statment

Scheduled Pinned Locked Moved Visual Basic
helpdatabase
4 Posts 4 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    hellow to all i am trying to make insert statment into a access database .. i write the folloing statment MyOledbCommand.CommandText = "Insert Into Messages " _ & "(firstname,lastname,username,password,date) " _ & "Values (" & "'" & String2 & "', " & "'" & String3 & "', " & "'" & String4 & "', " & "'" & String5 & "')" but i keep getting the msg Syntax error insert statment .. the more odd thing is that i use the same statment in other form and it run's fine ! what could be the problem .. i had tried million thing and possibilities nothing is working :( thxx a lot

    S K T 3 Replies Last reply
    0
    • A Anonymous

      hellow to all i am trying to make insert statment into a access database .. i write the folloing statment MyOledbCommand.CommandText = "Insert Into Messages " _ & "(firstname,lastname,username,password,date) " _ & "Values (" & "'" & String2 & "', " & "'" & String3 & "', " & "'" & String4 & "', " & "'" & String5 & "')" but i keep getting the msg Syntax error insert statment .. the more odd thing is that i use the same statment in other form and it run's fine ! what could be the problem .. i had tried million thing and possibilities nothing is working :( thxx a lot

      S Offline
      S Offline
      StealthMaker
      wrote on last edited by
      #2

      maybe the problem isnt with your statment, but with your connection?

      1 Reply Last reply
      0
      • A Anonymous

        hellow to all i am trying to make insert statment into a access database .. i write the folloing statment MyOledbCommand.CommandText = "Insert Into Messages " _ & "(firstname,lastname,username,password,date) " _ & "Values (" & "'" & String2 & "', " & "'" & String3 & "', " & "'" & String4 & "', " & "'" & String5 & "')" but i keep getting the msg Syntax error insert statment .. the more odd thing is that i use the same statment in other form and it run's fine ! what could be the problem .. i had tried million thing and possibilities nothing is working :( thxx a lot

        K Offline
        K Offline
        KaptinKrunch
        wrote on last edited by
        #3

        You may wnat to check the values of each string, If one of them contains a single quote mark, then your insert statement will fail.

        1 Reply Last reply
        0
        • A Anonymous

          hellow to all i am trying to make insert statment into a access database .. i write the folloing statment MyOledbCommand.CommandText = "Insert Into Messages " _ & "(firstname,lastname,username,password,date) " _ & "Values (" & "'" & String2 & "', " & "'" & String3 & "', " & "'" & String4 & "', " & "'" & String5 & "')" but i keep getting the msg Syntax error insert statment .. the more odd thing is that i use the same statment in other form and it run's fine ! what could be the problem .. i had tried million thing and possibilities nothing is working :( thxx a lot

          T Offline
          T Offline
          thealca
          wrote on last edited by
          #4

          "Date" is a VB reserved word, don't take it a habit of using reserved words, however u can still use it as a DB fieldm enclose it with "[]" MyOledbCommand.CommandText = "Insert Into Messages " _ & "(firstname,lastname,username,password,[date]) " _ & "Values (" & "'" & String2 & "', " & "'" & String3 & "', " & "'" & String4 & "', " & "'" & String5 & "')" good luck ;)

          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