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. Database exception handling??

Database exception handling??

Scheduled Pinned Locked Moved Visual Basic
databasecsharphelpquestion
2 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.
  • T Offline
    T Offline
    Tridip Bhattacharjee
    wrote on last edited by
    #1

    Say suppose I have developed a small application by vb.net, which will insert new record and modify existing record and delete existing record. At the time of inserting new record then primary key, index, unique key, check key can violate for reason like duplicate record, like null value. So how could I capture those errors separately and show proper message for different type of errors to user. At the time of deletion relation can violate say suppose user are trying to delete record from parent table where references are in the child table, at that time foreign key will violate and I want to capture that and show proper message to user. Please solve my problem giving me the proper exception handling code with comment implement by vb.net. tbhattacharjee

    D 1 Reply Last reply
    0
    • T Tridip Bhattacharjee

      Say suppose I have developed a small application by vb.net, which will insert new record and modify existing record and delete existing record. At the time of inserting new record then primary key, index, unique key, check key can violate for reason like duplicate record, like null value. So how could I capture those errors separately and show proper message for different type of errors to user. At the time of deletion relation can violate say suppose user are trying to delete record from parent table where references are in the child table, at that time foreign key will violate and I want to capture that and show proper message to user. Please solve my problem giving me the proper exception handling code with comment implement by vb.net. tbhattacharjee

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Since SQLServer is generating the errors, your SQL procedures can return codes to your VB.NET code so you can determine what to do with the errors there. But, if your code is written properly, your SQL database is setup and the stored procedures that do the actual work are written properly, you should never have to deal with foreign key violations like what your talking about. The only way a user can delete a record from a parent table and violate the child relations is if your code lets them do it in the first place. RageInTheMachine9532

      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