locked
Missing ";" trying to access DataWorkSpace froom button in html client screen RRS feed

  • Question

  • Hello,

    I am trying to follow Erick Erhardt's procedure to execute a stored procedure and am trying to do it from html client. I have a test button on my screen with the following code:

    myapp.BrowseTest.test_execute = function (screen) {
        // Write code here.
        DataWorkspace dataWorkspace = new DataWorkspace();
        var operation = dataWorkspace.ApplicationData.AddNew();
        .....
        ......

    I get an error stating that I am missing ";" in the statement  DataWorkspace dataWorkspace = new DataWorkspace();. I am using vs 2013 update 4. I don't understand what I am doing wrong.  DataWorkspace is not tinted in blue specifying it as a key word. Any help is appreciated!!!!!!!

    Thanks and kind Regards,

    Alberto

    Tuesday, December 23, 2014 4:07 PM

All replies

  • HI Alberto,

    If you want to learn how to execute stored procedures in Lightswitch, you can also take a look at this article below.

    Executing Stored Procedures in Lightswitch

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, December 26, 2014 9:52 AM
  • Angie,

    Thank you for your answer. Yes, I have tried that approach also. The problem I am getting is when writing the code for the button execute:

    DataWorkspace dataWorkspace = new DataWorkspace();

    DataWorkSpace is not recognized and I get an error specifying "Expected ;". It is not recognizing "DataWorkspace" as a key word and not creating "dataWorkspace". Also, the DataWorkspace() function is not recognized.

    Again, thank you and Kind Regards,

    Alberto

    Saturday, December 27, 2014 1:21 PM
  • HI Alberto,

    Thanks for your feedback.

    For this issue, perhaps there is something with your codes, here is a Lightswitch demo in MSDN library, please follow the steps, it will give some hints to execute a stored procedure in LightSwitch. Reference:

    How to: Execute a Stored Procedure in LightSwitch

    At the same time you can also enable diagnose in your Lightswith, perhaps it can give more hints why this happens.

    If it still has same issue, please don't hesitate to let me know, I will look into it further.  

    Best regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 1, 2015 7:12 AM
  • Angie,

    Thank you for your suggestions, I tried them and the results are the same. When I type the line:


     DataWorkspace dataWorkspace = new DataWorkspace();

    The Var "dataWorkspace" is inmediatley underlined in red and when hovering over it I get "Expected ;". Compilation works but when I enter the button code where the command line is typed I get the following:

    JavaScript critical error at line 6, column 19 in http://localhost:1182/HTMLClient/Screens/mytests/Browsemytests.lsml.js\n\nSCRIPT1004: Expected ';'

    The examples I have seen are executing the code I believe from Silverlight?. I am trying to execute it from the html client.

    myapp.Browsemytests.test_execute = function (screen) {
        // Write code here.
        DataWorkspace dataWorkspace = new DataWorkspace();

    From what I understand, creating the new record and saving it kicks off the insert on the server side which is used to trigger the stored procedure but we need to create a new DataWorkspace in order not to confuse it with the actual screen. Unfortunately, I cannot get it to work on the html client. Am I missing a reference?, I have tried using variations of the screen method with no success. The only thing I have not tried is using WebApi or wcf ria but both are complex and I would like to reuse code.

    Again, thank you for your suggestions and Kind Regards,

    Alberto

    Saturday, January 3, 2015 6:49 PM