Link to home
Start Free TrialLog in
Avatar of LelloLello
LelloLello

asked on

ODBC Error Code = 23000 (Integrity constraint violation)

My code is working fine but the insert is not going into the table why?
i'm having the following ODBC Error Code 230000

My ID is unique...

<!--- Insert a record of the Transaction in the Database --->
 						<cfquery name="InsertUserInfo" datasource="#application.datasource#" username="#application.username#" password="#application.password#" maxrows=25>
						INSERT INTO 
						tblC(dteDate, Name, Amount, Confirmation_Num, Invoice, CardNum, Data, Event)   
						Values('#DateFormat(NOW())#','#strBadgeName#','#intTotal#',
						<cfif CreditCard EQ "Yes"> 
						'#RESULT#',
						'#intReceiptID#',
						'#Mid(Form.intCardNo, 1, Len(Form.intCardNo)-4)#',				
						<cfelse>
						'','','',
						</cfif>
						'#text_to_insert#', 'CIA Network Subscription 2012') 
						
						</cfquery> 

Open in new window


My SQL Table

id  int  not allow nulls
dteDate datetime allownulls
name varchar 255 allow nulls
amount
Confirmation_num
Invoice
CardNum
Data
Event
Twelvedigits varchar50
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ha yes you're right bad suggestion (slaps self on wrist) possible do do safely but you do have to know what you're doing. Far easier to simply change the ID to autoInc.

A note about autoincrement. If you are using an autoincrement ID for a userid or something similiar it's important to not rely on that exclusively for things like displaying information via url variable or hidden form variables.

If you have sequential numbers and no other checks (such as against a session id set at login, it is simple to change a user id in a url or hidden form value to view another users information.

And in case you don't think this is a problem, it affects a major US govt website that we use on a regular basis. I've reported it twice but they still (last time I checked) haven't fixed it. The information disclosure isn't very sensitive but it should never happen.
Avatar of LelloLello
LelloLello

ASKER

You are the experts !! Thank you i saw the error on the increment in SQL. ... but i have a question on this form.

http://209.217.127.200/jp/registration_13_e_.cfm 

Right now i have two option.
Fellows, Affiliates or Correspondents of an actuarial organization or CFA members   100.00*
 
Associates of an actuarial organization   $525*

If i take out this line 'Associates of an actuarial organization   $525* ' my form tax calculations will not work and no one is able to know the problem so i will post the question pls help me.
http://209.217.127.200/jp/registration_14_e_.cfm 


Associates of an actuarial organization   $525*  


Please help me on that question... thank you.
https://www.experts-exchange.com/questions/27729200/if-document-SubmitRegistration-intOption-i1-checked-true.html
Looking forward for your advice on my other question.