Jump to content

Always check the id is duplicate


Personal_Worker

Recommended Posts

i have a problem in my asp program..i doing the duplicate id checking (id is my primary key) in my program, but after i entered the id and the data, the program always said that the ID is exist although in real, it is not exist....I find the way to solve the problem for whole day, but until now, i can not know what is wrong in may checking..this is my code for checking

'check for error<% if err.number <> 0		if err.number = -2147467259 then %>		  <script> window.alert("customer ID already exist!!\nPlease enter another ID\nThanks")</SCRIPT><%		else		  response.write "Unknown error ["& err.number & "]" & err.Description   	   end if		 response.end	  end if	%>

i hope for the answer, thanks before :)But For Your Information..my program can work in the another computer which is using older microsoft access (as i thought), is that any relation between my problem and the access version??This is my code on how i insert the new record...

set conn=CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open server.mappath("mr.mdb")conn.execute "INSERT INTO [customer] ([Customer_ID],[Customer_Name],[Customer_Address],[Email_Address],[Contact_Number],[Fax_Number],[Contact_Person])VALUES("&id&",'"&name&"','"&address&"','"&email&"','"&cont_num&"','"&fax&"','"&cont_person&"')" 	 	conn.close

Thanks....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...