Hello all,,
I was having a project that save to database with auto number, now i need to update the data that had been save before as same number.
But i was having a problem that while i update it, it save to new number, but not old number.
Can you give me an advice?
this is my update code
I was having a project that save to database with auto number, now i need to update the data that had been save before as same number.
But i was having a problem that while i update it, it save to new number, but not old number.
Can you give me an advice?
this is my update code
con = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\notifdb.accdb")
con.Open()
Dim strsql2 As String = ("update NFTB set NOTIF =@NOTIF, EMP_NO =@EMP_NO, EMP_NAME =@EMP_NAME, [POSITION] =@POSITION, APP_DATE =@APP_DATE, APP_DT_FROM =@APP_DT_FROM, APP_DT_TO =@APP_DT_TO, APP_TIME =@APP_TIME, APP_TIME_FROM =@APP_TIME_FROM, APP_TIME_ON =@APP_TIME_ON, REASONS =@REASONS, REMARKS =@REMARKS, TIME_IN =@TIME_IN, TIME_OUT =@TIME_OUT, CHECKED_IN =@CHECKED_IN, CHECKED_OUT =@CHECKED_OUT, IN_ON =@IN_ON, OUT_ON =@OUT_ON, APP =@APP, APP_MAIL =@APP_MAIL, APP_OWN =@APP_OWN WHERE [S/N] =@S/N")
Dim command2 As New OleDb.OleDbCommand(strsql2, con)
command2.Parameters.AddWithValue("@NOTIF", NOTIFTextBox.Text)
command2.Parameters.AddWithValue("@EMP_NO", EMP_NOTextBox.Text)
command2.Parameters.AddWithValue("@EMP_NAME", EMP_NAMETextBox.Text)
command2.Parameters.AddWithValue("@POSITION", POSITIONTextBox.Text)
command2.Parameters.AddWithValue("@APP_DATE", APP_DATETextBox.Text)
command2.Parameters.AddWithValue("@APP_DT_FROM", APP_DT_FROMTextBox.Text)
command2.Parameters.AddWithValue("@APP_DT_TO", APP_DT_TOTextBox.Text)
command2.Parameters.AddWithValue("@APP_TIME", APP_TIMETextBox.Text)
command2.Parameters.AddWithValue("@APP_TIME_FROM", APP_TIME_FROMTextBox.Text)
command2.Parameters.AddWithValue("@APP_TIME_ON", APP_TIME_ONTextBox.Text)
command2.Parameters.AddWithValue("@REASONS", REASONSTextBox.Text)
command2.Parameters.AddWithValue("@REMARKS", REMARKSTextBox.Text)
command2.Parameters.AddWithValue("@TIME_IN", TIME_INTextBox.Text)
command2.Parameters.AddWithValue("@TIME_OUT", TIME_OUTTextBox.Text)
command2.Parameters.AddWithValue("@CHECKED_IN", CHECKED_INTextBox.Text)
command2.Parameters.AddWithValue("@CHECKED_OUT", CHECKED_OUTTextBox.Text)
command2.Parameters.AddWithValue("@IN_ON", IN_ONTextBox.Text)
command2.Parameters.AddWithValue("@OUT_ON", OUT_ONTextBox.Text)
command2.Parameters.AddWithValue("@APP", APPTextBox.Text)
command2.Parameters.AddWithValue("@APP_MAIL", APP_MAILTextBox.Text)
command2.Parameters.AddWithValue("@APP_OWN", APP_OWNTextBox.Text)
command2.Parameters.AddWithValue("@S/N", Convert.ToInt32(S_NTextBox.Text))
command2.ExecuteNonQuery()
con.Close()