Hi,
I think the code can be improved by separating UI, business logic and database queries.
Regarding input validations from the UI on input (validations on client side such as with JavaScript/jQuery) and on button click (validations on server side such as with C#) you should validate the input as txtinput.Text may not match field type in database.
From the table schema, it's unclear which is the PK...there is User_ID and Unique_No
Seems like you're missing connection to dbcommand:
OleDbCommand.Connection Property (System.Data.OleDb)[
^]
cmd.Connection = con;
Also might be better to use try catch finally to check for any errors. The error may not always be invalid unique no.
try
{
...database related code
}
catch(Exception ex)
{
}
finally{
con.Close();
}