in reply to problem with script transfered from VBS

Hi ,

What the error is telling you is that the result of the call $rs->Fields('AEName') does not result in writeable data - hence the change you made to $nTemplateID = $rs->Fields('AETemplateID'); (to read $nTemplateID = $rs->Fields('AETemplateID')->value;), but only in certain/that instance.

Why not try applying the same change to $rs->Fields('AEName') and $rs->Fields('ADAS_ID') i.e. to read $rs->Fields('AEName')->value and $rs->Fields('ADAS_ID')->value.

Just a suggestion,

HTH ,

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: problem with script transfered from VBS
by xiaoyafeng (Deacon) on Aug 06, 2008 at 11:53 UTC
    thanks for your reply. I've tried: $rs->Fields('AEName')->value = $psProxyName; $rs->Fields('ADAS_ID')->value = $nDeviceID; but throw the same error, Can't modify non-lvalue subroutine call at cmp2.pl line 60. How can I do?

    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
      No problem :-)

      Looking again at your original change, it was in the context of using value as a method to get the current value for an assignment.

      You could try, instead of $rs->Fields('AEName')->value = $psProxyName;, $rs->Fields('AEName')->value($psProxyName);...

      At last, a user level that overstates my experience :-))
        Thanks for your prompt reply! I don't need to drain my brain as much since I got your help.
        I've tried as your suggestion, the good news is perl didn't throw any error. the bad news is it did do anything!:(
        I place print $rs->Fields('AEName')->value($psProxyName) after and before the statment. below are output
        VB script: wscript.echo "AEName old value is" wscript.echo rs.Fields( "AEName" ).value wscript.echo "ADAS_ID old value is" wscript.echo rs.Fields( "ADAS_ID" ).value rs.Fields( "AEName" ) = psProxyName rs.Fields( "ADAS_ID" ) = pnDeviceID wscript.echo "AEName new value is" wscript.echo rs.Fields( "AEName" ).value wscript.echo "ADAS_ID new value is" wscript.echo rs.Fields( "ADAS_ID" ).value wscript.echo rs.Fields( "AEName" ).value wscript.echo rs.Fields( "ADAS_ID" ).value __OUTPUT__ C:\>cscript cmp.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. AEName old value is Mp_Default ADAS_ID old value is null AEName new value is MyTestMeterProxy06 ADAS_ID new value is 1415 Meter proxy created having the ID: 673132 Script Finished
        perl script print "ADAS_ID old value is", $rs->Fields('ADAS_ID')->value."\n"; print "AEName old value is", $rs->Fields('AEName')->value."\n"; print "\$psProxyName value is $psProxyName\n"; print "\$pnDeviceID value is $pnDeviceID\n"; $rs->Fields('AEName')->value($psProxyName); $rs->Fields('ADAS_ID')->value($pnDeviceID); print "ADAS_ID new value is", $rs->Fields('ADAS_ID')->value."\n"; print "AEName new value is", $rs->Fields('AEName')->value."\n"; $nCheckoutID = $ctMgr->Checkout($pnContainerID, $aSec); __OUTPUT__ C:\>perl cmp2.pl ADAS_ID old value is AEName old value isMp_Default $psProxyName value is MyTestMeterProxy010 $pnDeviceID value is Win32::OLE=HASH(0x1987448) ADAS_ID new value is AEName new value isMp_Default Meter proxy created having the ID: Script Finished
        I'm confused with output above. It seems to me '->value($psProxyName)' doesn't work?
        How can I continue?

        BTW: what can I benifit from overstating my experience?

        I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction