1
Answer

value validation

sachi vasishta

sachi vasishta

15y
1.8k
1

Hi,

I have a winform that contains the following

4 textboxes and a button.

a)first name b)ssn c)lastname d)city e)zip

 here if  the user doesnot enter the values for first name and/or last name then it should give a message saying please enter the first name and/or last name . And the zip field's value is 5 characters so if the user enters lessthan or morethan 5 characters then again it should give a message saying zip values is too short or too long.

 

 

Answers (1)
0
Satyaprakash Samantaray

Satyaprakash Samantaray

NA 9.7k 1.1m 7y
https://www.codeproject.com/Articles/10223/Using-Transactions-in-ADO-NET
0
Tapan Patel

Tapan Patel

NA 8.1k 100.8k 7y
You need to surround your code with try catch block for each of the database operations in your methods and in order to rollback you can always use sqltransaction.begintransaction and sqltransaction.rollback methods.
 
Take a look at detailed example below:
http://www.c-sharpcorner.com/UploadFile/rohatash/performing-sql-server-transaction-using-ado-net/