One or more rows contain values violating non-null, unique or foreign-key contraints.

jsandoval

Active member
Joined
Dec 27, 2004
Messages
28
Location
Denver
Programming Experience
10+
I am trying to perform a data adapter fill and get this message. The record in the data source exists and it is a unique keyed record so I can't find the issue with the application.

Any help would be appreciated.

'---------------------------------------------------------------------------

SelComm = "SELECT ICRKAA, ICRLAA, ICZRNU, ICZSNU, ICGZCD, ICB1CD, ICCJNB, ICCINB, " & _

"ICCHNB, ICRBAA, ICUXSU, ICA1NB, ICE1TX, ICE2TX, ICCYNB, ICKPNB, ICLHNB, " & _

"ICAXCD, ICKQNB, ICE9TX, ICBZCD, ICDBST, ICCXNB, ICNONB, ICKGNB, ICACPR, " & _

"ICADPR, ICAEPR, ICD3NB, ICD2NB, ICCJVN, ICLPNB, ICE8TX, ICE7TX, ICPPSU, " & _

"ICPQSU, ICPRSU, ICADPR " & _

"From " & Current.Application("DBLibDTA") & ".SCICWU " & _

"Where ICRKAA = 'I' and ICRLAA = 'ZZZZZ' and ICZRNU = 99999999 " & _

"and ICZSNU = 999 and ICGZCD = '" & strServiceGroup & "' " & _

"and ICB1CD = '" & strPrefix & "' and ICCJNB = " & intContractNbr & " " & _

"and ICCINB = 1 and ICCHNB = 1 and ICRBAA = '" & strTranType & "'"

OdbcDataAdapter1.SelectCommand.CommandText = SelComm

dSet.Clear()

'Try

intICWRecCnt = OdbcDataAdapter1.Fill(dSet)

 
Hi,
If you are not joining any tables, these errors (usually) mean that you have an error in your query, get a print out of your command string (selComm) and try to run the query. More than likely the query will not be accepted. So you debug the query and fix it, and they (records) will come.

Another reason, although highly unlikely since you are clearing your dataset. You are loading child tables before loading parent tables. Loading a dataset with datarelations needs to be done in a top down manner.

But, you are clearing the dataset, so it should not be the problem.

-Edward
 
Back
Top