Runtime error 2147467259(80004005): The changes you requested to the table were not successful because they would create duplicate values in the index, primary key..How to catch the exception?
Unfortunately there is no try catch block in VB6... You have to go back to the good old fashioned On Error
Do you want to handle the error in your code? or are you trying to figure out where it occurred?
If you're handling in the code you have two choices:
'Example of sub routine with GOTO sub myGotoRoutine() On Error Goto Err_Handler '..... do what ever Exit sub Err_Handler: 'What do you want to do with the Error? exit sub 'Example of sub routine with resume next sub myNextRoutine() On Error Resume Next 'Doing something that could lead to an error if Err.Number <> 0 then 'Handle error Err.clear End if '... Exit sub
The On Error Goto Option means that if there is an error go directly to the marked line of code. In the example I've done if there is an error anywhere in the sub routine then the code jumps down into my error handler if not, it will hit the line Exit sub beforehand and not go in.
The On Error Resume Next means exactly that, if there is an error, carry on to the next line of code. In my example I trap and handle the error on the next line.
If you are trying to figure out where it happens, you need to put brek points in your code and step through it.
As an educated guess, I'd say the code is trying to insert a record into a database table with a primary Key value that is already in use rather than an update.
Edited 3 Years Ago by G_Waddell
write a C++ program which take inputs from the user/keyboard and calculate his ZAKAT.
get the input from user may include
-Amount invested in business
-Amount given to other business partners as loan
-Amount payable to others
I made a prime number finder, it finds the nearest prime that is above and below any integer (Does not work that well with giant numbers.)
Made this in cpp.sh
Why would I need the x=y+1-1;?
x=y; just doesnt seem to work
Why is this?
And I know my coding ...
there are five tables (personTb, addressTb,churchTb) each holds data pertinent to an individual; (personAddress,personChurch) each hold the primary key for the person table and corresponding table IE personAddress holds primary key for addressTb.
both snippets work, my question is; Is my join correctly formatted?
select concat(personTb.p_fName,' ',personTb.p_mName,'. ',personTb.p_lName) ...