Click here to Skip to main content
15,891,409 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am new to programming.
I am working on project.
I have bind Gridview and on the selection of the row from gridview a formview
appear with all details .
I have give option over their to edit record.
I have total 32 textbox.
amoung them i have field whose datatype is Decimal and Datetime
But if the decimal field are left blank and click on update it show error that
Error converting data type varchar to numeric.
And after update how to return from edit mode to readonly mode in form view
Posted
Updated 9-Apr-12 9:02am
v2
Comments
Sergey Alexandrovich Kryukov 9-Apr-12 12:49pm    
There are many ways to screw up things. How can we know which one is your favorite? :-)
"Improve question" is above.
--SA

1 solution

Instead of blindly passing data to the database(?) -- not sure if that is where you are sending your data since you don't specify!

You need to meet with the users, determine what the default values should be, then set the fields to the default value if xn.Text.Length.Equals(0) | xn is one of your 32 text boxes.

The other alternative (if there is no default) is change the database to accept null values. Then null is the default value if no value is entered.

Programming 101 for this problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900