locked
Update all Coversion error RRS feed

  • Question

  • User-1708310043 posted

    in update  all one column below code:

    but the error occured anyone solve this problem

    update Menucard set [Final Amount]=(Amount* '" +Val(txtBox.Text) +"' /100)+Amount

    below is error:

    Conversion from string "update Menucard set [Final Amoun" to type 'Double' is not valid.

    Wednesday, December 7, 2011 11:22 PM

Answers

  • User1983249378 posted

    If using vb.net then

    update Menucard set [Final Amount]=(Amount* '" +CDbl(txtBox.Text) +"' /100)+Amount

    For c#

    update Menucard set [Final Amount]=(Amount* '" +Convert.ToDouble(txtBox.Text) +"' /100)+Amount

    Remember your must provide some validation control on your textbox , if some one provides NaN values or null value or Text value then your code breaks again 

    So validation control keeps on checking then some number must be provided in order to perform that experssion operation.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, December 7, 2011 11:33 PM