It shows no error because you swallow the exception:
Try
AddEmpCmd.Parameters.AddWithValue("'@CurrYear'", CmbYear.Text)
AddEmpCmd.Parameters.AddWithValue("@Sap_No", TxtSapID.Text)
AddEmpCmd.ExecuteNonQuery()
Dbconnection.Close()
Catch ex As Exception
End Try
When you do that, it's as if the error never occured - you get no message, you get no error. And you can;t see what the problem was, because you discard all the info that tells you!
Start with this:
Try
AddEmpCmd.Parameters.AddWithValue("'@CurrYear'", CmbYear.Text)
AddEmpCmd.Parameters.AddWithValue("@Sap_No", TxtSapID.Text)
AddEmpCmd.ExecuteNonQuery()
Dbconnection.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
And that will give you the basic info on the Output Pane of the debugger. add a breakpoint on the MessageBox line, and you can get further info from the Exception object using the debugger.
Once you have that, it may be clearer what the problem is - but without it you are just guessing!