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. Which Exception appears when insert duplicated data (primairy key in a database

Which Exception appears when insert duplicated data (primairy key in a database

Scheduled Pinned Locked Moved Visual Basic
questiondatabaselounge
5 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.
  • K Offline
    K Offline
    keninfo
    wrote on last edited by
    #1

    Hello, Which Exception appears when inserting duplicated data (primairy key) in a database? In my application "System.Data.OleDb.OleDbException" appeared but that seems to general to me?? And how can i use the try, catch statement? Thanks

    C 1 Reply Last reply
    0
    • K keninfo

      Hello, Which Exception appears when inserting duplicated data (primairy key) in a database? In my application "System.Data.OleDb.OleDbException" appeared but that seems to general to me?? And how can i use the try, catch statement? Thanks

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      That looks about right, it's a database exception, and there are not exceptions defined for everything that can happen in the DB. The text of the exception will explain it

      keninfo wrote:

      And how can i use the try, catch statement?

      If you really don't know how to use try/catch, you probably need to buy a book on VB and work through it. Or, at least try google.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      K 1 Reply Last reply
      0
      • C Christian Graus

        That looks about right, it's a database exception, and there are not exceptions defined for everything that can happen in the DB. The text of the exception will explain it

        keninfo wrote:

        And how can i use the try, catch statement?

        If you really don't know how to use try/catch, you probably need to buy a book on VB and work through it. Or, at least try google.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

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

        I know a little how try catch is working but can you help me a little ?

        D C 2 Replies Last reply
        0
        • K keninfo

          I know a little how try catch is working but can you help me a little ?

          D Offline
          D Offline
          Dave Sexton
          wrote on last edited by
          #4

          Try
          ' do your processing here

          Catch (WhateverException As Exception)
          ' handle the error here

          Finally
          ' any additional processing that needs
          ' doing regardless of error handling
          ' release database connections, etc.

          End Try

          Read this[^] for more info.

          1 Reply Last reply
          0
          • K keninfo

            I know a little how try catch is working but can you help me a little ?

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Well, I assume you knew what you've been told ( as it's the bare bones of what try/catch does ). What did you need to know ?

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            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