none
Problem converting to int64 from string

    Question

  • In the link

    https://msdn.microsoft.com/en-us/library/0zahhahw(v=vs.110).aspx

    The following statement of your example does not work in MVC 5.

    result = Convert.ToInt64(value);

    It will not compile and produces 3 errors:

    Error      1              Invalid token '=' in class, struct, or interface member declaration                H:\cciInventory\Developement\InventoryExperiment1\InventoryExperiment1\Classes\ItemDataControllerManager.cs                23           16           InventoryExperiment1

    Error      3              Invalid token ')' in class, struct, or interface member declaration                H:\cciInventory\Developement\InventoryExperiment1\InventoryExperiment1\Classes\ItemDataControllerManager.cs                23           42           InventoryExperiment1

    Error      2              Invalid token '(' in class, struct, or interface member declaration                H:\cciInventory\Developement\InventoryExperiment1\InventoryExperiment1\Classes\ItemDataControllerManager.cs                23           34           InventoryExperiment1

     

    This example works fine in WebForms but not on our machines using MVC5.

     

    Any Suggestions would be appreciated.

     

    Regards,

    Stephen S. Baca

    ssbaca@computer.org

    Wednesday, October 05, 2016 5:09 PM

Answers

  • Seems that ‘result = Convert.ToInt64( value )’ is misplaced. For example, it cannot appear inside a class outside the functions. Show some details about your class and make sure that the program is structured correctly.

    • Marked as answer by Stephen S Baca Wednesday, October 05, 2016 8:26 PM
    Wednesday, October 05, 2016 5:52 PM