QueryObject - Field Not Found

Good day

My code looks like this:

var string = "DECLARE @NOTEOUTPUT VARCHAR(8000) Exec PARSE_SCRIPT '"+data+"', "+caseid+", 1, @Noteoutput output select @noteoutput as documentOutput";

var mySQL = string;

var myQuery = CRM.CreateQueryObj(mySQL,"");

myQuery.SelectSQL();

Response.

data= myQuery("documentOutput")

I get the following errors:

eWare.eWareQuery error '8000ffff'

[SafeCall Exception]: field documentOutput not found

/crm/CustomPages/Cases/CasesPDFApproval.asp, line 26

When I run the query in SQL management studio I do get a result with one row and one column.

I do not understand what I am doing wrong.

Please assist.

  • 0

    Hi Nic,
     
    Try the below code snippet.
     
    <snippet>
    var sOutput = "";
    var sSQL = "DECLARE @NOTEOUTPUT VARCHAR(8000) Exec PARSE_SCRIPT '"+data+"', "+caseid+", 1, @Noteoutput  output select @noteoutput as documentOutput";
    var objQueryObj = eWare.CreateQueryObj(sSQL);
    objQueryObj.SelectSQL();
     
    if(!objQueryObj.eof)  
    {
                sOutput = new String(objQueryObj("documentOutput"))
                if(sOutput=="" || sOutput=="null" || sOutput=="undefined")sOutput=""
    }
     
    Response.Write(sOutput);               //’This will print the value of documentOutput
    </snippet>
     
    Hope this helps!
     
    Regards
    Dinesh

  • 0

    Hi Dinesh

    Thank you for the reply.

    I have copied over my code with yours and now I get the following error:

    eWare.eWareQuery error '800a0e78'

    [SafeCall Exception]: Operation is not allowed when the object is closed

    /crm/CustomPages/Cases/CasesPDFApproval.asp, line 29

    Line 29: if(!objQueryObj.eof)

    Please advise what I am doing wrong

  • 0

    Hi Nic,
     
    We tried the same thing at our end and found that its working as expected. It seems that there is something wrong in your stored procedure. Could you please check the same.
     
    Regards
    Dinesh