Results 1 to 3 of 3

Thread: !!! Primary Key Error Urgent !!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Posts
    73

    !!! Primary Key Error Urgent !!!

    Hi,
    Some how tried to write reterive code but got this error when issued this code dataset.EnforceConstrationst = True

    "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."

    How should i go about ...

    Please guide

    Wrgds
    Ganesh.K

  2. #2
    Addicted Member CoMMiE's Avatar
    Join Date
    Jul 2000
    Location
    Malaysia, Kuala Lumpur
    Posts
    179
    Hi
    try and check the table you are retriveing data from and make sure there is no duplicate value or null value before you set dataset.EnforceConstrationst = True in your code

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Posts
    73
    Hi,
    below is the code is written in txtempno validate
    ''''
    Me.objdsEmployee.EnforceConstraints = False
    sCurrentValue = txtEmpNo.Text
    Me.BindingContext(objdsEmployee, "employee").CancelCurrentEdit()
    Me.objdsEmployee.Clear()
    Me.BindingContext(objdsEmployee, "employee").CancelCurrentEdit()
    Me.OleDbDataAdapterEmployee.SelectCommand.Parameters("employeeCode").Value = sCurrentValue
    Me.OleDbDataAdapterEmployee.Fill(objdsEmployee)
    Me.OleDbDataAdapter2.Fill(objdsEmployee)
    Me.objdsEmployee.EnforceConstraints = True
    ''''

    in the above code which point should i check fields are having null values..

    please guide i'm new to VB.Net


    Wrgds
    Ganesh.K

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width