0

database - field[counterx3 - Id(text)Primary Key]

my code works really well before but when i changes and add codes in the others forms i got error in updating the value in my database, here's my code for update

 sql = "update counterx3 set ID='" & Val(acsdr!ID) + 1 & "'"
        Dim ccmd = New OleDb.OleDbCommand(sql, con)
        ccmd.ExecuteNonQuery()
        ccmd.Dispose

and here's the other one

    Public Sub ordernumber()
        sql = "select * from counterx3"
        Dim cmd = New OleDb.OleDbCommand(sql, con)
        acsdr = cmd.ExecuteReader()
        If acsdr.Read Then
            lblordernum.Text = "ORDER NUMBER: " & acsdr!ID
        End If
        Me.Refresh()
    End Sub

my error is in the update, it says "No data exists for the row/column."
Please help, i'm working on this error since last night :( , but i really can't figure out what the reason of the error

2
Contributors
6
Replies
22
Views
2 Years
Discussion Span
Last Post by Mr.M
0

Can you capture the error in debug mode so we can see which line produce the error.

0

Try to verify if the variables that host data to be updated to a database do return or hold something, mean check if they are not null, because it seems as if one or more variable has no data within it, its null.

0

it's not null, actually when i save a new record in database in different field the counterx3-id need to be increment

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.