Column is constrained to be unique 
Author Message
 Column is constrained to be unique

Hello,

I am having an issue where when I am trying to load data
into a table that replaces an old record that was
previously in the table, occasionally the old record is
not being found so that I can delete the old record and
write a new record to replace.  The code snippet that I
am using is pasted below.

Private Function load_msg48()
    On Error GoTo Load_msg48_err
    Dim innode As Byte
    Dim findrow As DataRow
    Dim addrow As DataRow = Wccoordin1.wccoordin.NewRow()
    Dim strmsg As String
    innode = inbyte(1)
    findrow = Wccoordin1.wccoordin.FindByNode(innode)
    If Not findrow Is Nothing Then
        findrow.Delete()
        OleDbDataAdapter18.Update(Wccoordin1)
    End If
    addrow("Node") = innode
    addrow("timezone") = BuildShort(inbyte(2), inbyte(3))
    addrow("daylightflag") = inbyte(4)
    addrow("Degreeslattitude") = BuildShort(inbyte(7),
inbyte(8))
    addrow("Minuteslattitude") = BuildShort(inbyte(5),
inbyte(6))
    addrow("degreeslongitude") = BuildShort(inbyte(11),
inbyte(12))
    addrow("Minuteslongitude") = BuildShort(inbyte(9),
inbyte(10))
    Wccoordin1.wccoordin.AddwccoordinRow(addrow)
    OleDbDataAdapter18.Update(Wccoordin1)
    loaderror = 0
    load_msg48 = 0

load_msg48_exit:
    Exit Function

Load_msg48_err:
    strmsg = Err.Description & " the input node is " &
innode
    write_error(msgnum, innode, strmsg)
    loaderror = 1
    load_msg48 = 1
    GoTo load_msg48_exit
End Function

This code should ideally find the old record for the node
and then delete the old record and replace it with a new
record.  But in looking at my error log file I can see
that this is not happening consistently.  Can anyone
point in in the direction of how to get rid of the
inconsistency in finding records that do exist and do
match the node value that the field innode holds in it.

Thanks

Eric Lommatsch



Mon, 27 Dec 2004 05:22:47 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. I am trying to update a record, i am not using data control

2. I am learning VB.NET and am wondering....

3. I am trying to update a record, i am not using data control

4. Unique Key Constrain problem

5. When is 5:00 AM not 5:00 AM? When it's 5:00 AM.

6. Am I missing something or am I just plain dumb?

7. Am I missing something???? Or Am I just Dumb????

8. Am I an .EXE, or am I running under VB env?

9. I am stopping(error 70) when I am distributing a client program using DCOM server.

10. I am trying to create a database application. I am using a data control

11. I am trying to create a database application. I am using a data control

12. I am trying to create a database application. I am using a data control

 

 
Powered by phpBB® Forum Software