Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

Hi

I am developing an ADO.NET Application that binds a hypothetical school database to the user interface.All tables contain primary keys.In the interface the user may add new records.I used my own logic to create a unique primary key.

Note:After the error occured(I bound the primary key to a text box and entered it manually with each new added record to make sure it is uniqe)and all the other feilds in the table are (fname,sname...etc)

When Use the DataAdapter.Update() method i get the following exception

System.Data.OleDBException:The changes you requested to the table were not successful because they would create duplicate values in the index,primary key,or relationship

 

This is very strage??

SimpleDatabaseApplication.zip

Edited by PlausiblyDamp
Life is the biggest school
Posted
set Unique Constraint to false

Hi

This will not solve the problem

I discovered that the column takes the default value from the access file

So,whatever rows I add, they will take the same value, which is the default value of the column determined by the access database.

 

Using autonumber will solve the problem when adding new row and updating and even deleting,but it will cause big problems with relations between tables

Life is the biggest school

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...