ASP.NET - ProcessBatchData - 'Value does not fall within the expected range'

Asked By Anandh Ramanujam on 01-Feb-11 08:22 AM
Hi,

Im getting "Value does not fall within the expected range" error.

string myGuid = lstIndustry.ID.ToString();

string strqry = "<?xml version=\"1.0\"encoding=\"UTF-8\"?>"

+ "<Batch>"

+ "<Method ID='A1'>"

+ "<SetList>" + myGuid + "</SetList>"

+ "<SetVar Name='ID'>122</SetVar>"

+ "<SetVar Name='Cmd'>Delete</SetVar>"

+"</Method>
+"</Batch>"
;

pwsite.RootWeb.ProcessBatchData(strqry);


Any thing wroing in this code

James Murray replied to Anandh Ramanujam on 01-Feb-11 04:42 PM
Hello Anandh,

I believe your missing a quotation at the end of  +"</method>"

That would produce a strqry ending in </Method>+ with no closure of your batch tag nor an end of line.

string myGuid = lstIndustry.ID.ToString();

string strqry = "<?xml version=\"1.0\"encoding=\"UTF-8\"?>"

+ "<Batch>"

+ "<Method ID='A1'>"

+ "<SetList>" + myGuid + "</SetList>"

+ "<SetVar Name='ID'>122</SetVar>"


+ "<SetVar Name='Cmd'>Delete</SetVar>"

+"</Method>
+"</Batch>"
;


pwsite.RootWeb.ProcessBatchData(strqry);