wrote:
String str = "update State set name='" + this.txtstatename.Text + "'where code='" + this.txtstatecode.Text + "'";
This updates the data. IF you want to show a new record, you need to insert a new record instead. If you need to do an update, you need to keep version numbers in your SQL, so you can do a SQL request that shows latest versions, AND do one that shows the old versions for your requirement.
Also, this code makes clear that you really don't know what you're doing. I hope that no-one is paying for this code, or expecting to use it in real life. You should read up on SQL injection to see how any user can destroy your database because of this sort of code. You should also learn about writing proper data layers and using config files. How often do you specify your connnection string in your project ? It should be written once, and once only.