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. Don't what is the error in my code thats not worked any idea?

Don't what is the error in my code thats not worked any idea?

Scheduled Pinned Locked Moved Visual Basic
questionhelp
6 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.
  • I Offline
    I Offline
    idsanjeevjha
    wrote on last edited by
    #1

    sorry for posting second question on same topic becouse second is for display data is posted by mistake and try to modify in edit mode thats is not shown ,

    'this code is worked
    isql="Insert Into students(id, first_name, last_name, major,current_credits) values (?, ?, ?, ?, ?)"
    idbcomm=new odbccommand(isql,dbconn)
    idbcomm.Parameters.Add("id", id.Text)
    idbcomm.Parameters.Add("fname", fname.text)
    idbcomm.Parameters.Add("lname", lname.Text)
    idbcomm.Parameters.Add("major", major.Text)
    idbcomm.Parameters.Add("credits", credits.Text)
    idbcomm.ExecuteNonQuery()
    'This code is not working reports error
    'lsSQL ="Insert Into stud(id,firstname,lastname,major) values (@id,@fname,@lname,@major)"
    'idbcomm=new odbccommand(isql,dbconn)
    'idbcomm.Parameters.Add( "@id",id.Text)
    'idbcomm.Parameters.Add( "@fname",fname.text)
    'idbcomm.Parameters.Add( "@lname",lname.Text)
    'idbcomm.Parameters.Add( "@major",major.Text)
    idbcomm.ExecuteNonQuery()

    sanjeev

    L N C 3 Replies Last reply
    0
    • I idsanjeevjha

      sorry for posting second question on same topic becouse second is for display data is posted by mistake and try to modify in edit mode thats is not shown ,

      'this code is worked
      isql="Insert Into students(id, first_name, last_name, major,current_credits) values (?, ?, ?, ?, ?)"
      idbcomm=new odbccommand(isql,dbconn)
      idbcomm.Parameters.Add("id", id.Text)
      idbcomm.Parameters.Add("fname", fname.text)
      idbcomm.Parameters.Add("lname", lname.Text)
      idbcomm.Parameters.Add("major", major.Text)
      idbcomm.Parameters.Add("credits", credits.Text)
      idbcomm.ExecuteNonQuery()
      'This code is not working reports error
      'lsSQL ="Insert Into stud(id,firstname,lastname,major) values (@id,@fname,@lname,@major)"
      'idbcomm=new odbccommand(isql,dbconn)
      'idbcomm.Parameters.Add( "@id",id.Text)
      'idbcomm.Parameters.Add( "@fname",fname.text)
      'idbcomm.Parameters.Add( "@lname",lname.Text)
      'idbcomm.Parameters.Add( "@major",major.Text)
      idbcomm.ExecuteNonQuery()

      sanjeev

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Please Check your data type against your Variable data. and why you use Paramenters. It is meaning less. Anubhava

      1 Reply Last reply
      0
      • I idsanjeevjha

        sorry for posting second question on same topic becouse second is for display data is posted by mistake and try to modify in edit mode thats is not shown ,

        'this code is worked
        isql="Insert Into students(id, first_name, last_name, major,current_credits) values (?, ?, ?, ?, ?)"
        idbcomm=new odbccommand(isql,dbconn)
        idbcomm.Parameters.Add("id", id.Text)
        idbcomm.Parameters.Add("fname", fname.text)
        idbcomm.Parameters.Add("lname", lname.Text)
        idbcomm.Parameters.Add("major", major.Text)
        idbcomm.Parameters.Add("credits", credits.Text)
        idbcomm.ExecuteNonQuery()
        'This code is not working reports error
        'lsSQL ="Insert Into stud(id,firstname,lastname,major) values (@id,@fname,@lname,@major)"
        'idbcomm=new odbccommand(isql,dbconn)
        'idbcomm.Parameters.Add( "@id",id.Text)
        'idbcomm.Parameters.Add( "@fname",fname.text)
        'idbcomm.Parameters.Add( "@lname",lname.Text)
        'idbcomm.Parameters.Add( "@major",major.Text)
        idbcomm.ExecuteNonQuery()

        sanjeev

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        idsanjeevjha wrote:

        'This code is not working reports error

        What is the error ? You have use @ symbol for parameter. I believe you should use ? symbol for parameters in Odbc.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        I 1 Reply Last reply
        0
        • N N a v a n e e t h

          idsanjeevjha wrote:

          'This code is not working reports error

          What is the error ? You have use @ symbol for parameter. I believe you should use ? symbol for parameters in Odbc.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          I Offline
          I Offline
          idsanjeevjha
          wrote on last edited by
          #4

          i am getting ERROR [42000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00936: missing expression. ya i have to use ? symbol for parameter in odbce but why @ is used in sql or msaccess thanks

          sanjeev

          N 1 Reply Last reply
          0
          • I idsanjeevjha

            sorry for posting second question on same topic becouse second is for display data is posted by mistake and try to modify in edit mode thats is not shown ,

            'this code is worked
            isql="Insert Into students(id, first_name, last_name, major,current_credits) values (?, ?, ?, ?, ?)"
            idbcomm=new odbccommand(isql,dbconn)
            idbcomm.Parameters.Add("id", id.Text)
            idbcomm.Parameters.Add("fname", fname.text)
            idbcomm.Parameters.Add("lname", lname.Text)
            idbcomm.Parameters.Add("major", major.Text)
            idbcomm.Parameters.Add("credits", credits.Text)
            idbcomm.ExecuteNonQuery()
            'This code is not working reports error
            'lsSQL ="Insert Into stud(id,firstname,lastname,major) values (@id,@fname,@lname,@major)"
            'idbcomm=new odbccommand(isql,dbconn)
            'idbcomm.Parameters.Add( "@id",id.Text)
            'idbcomm.Parameters.Add( "@fname",fname.text)
            'idbcomm.Parameters.Add( "@lname",lname.Text)
            'idbcomm.Parameters.Add( "@major",major.Text)
            idbcomm.ExecuteNonQuery()

            sanjeev

            C Offline
            C Offline
            Chinners
            wrote on last edited by
            #5

            It may not help much, but when using an old version of sqlce, I used to use the following to add a parameter to the query:

            cmd.Parameters.Add(New SqlCeParameter("id", SqlDbType.Int)).Value = nextID

            maybe you can modify to get it working?

            1 Reply Last reply
            0
            • I idsanjeevjha

              i am getting ERROR [42000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-00936: missing expression. ya i have to use ? symbol for parameter in odbce but why @ is used in sql or msaccess thanks

              sanjeev

              N Offline
              N Offline
              N a v a n e e t h
              wrote on last edited by
              #6

              That depends on the databases. SQL and access uses @ symbol.

              All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

              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