Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to initialize the instance first:</p> <pre><code>rec = new Record(name, age, dob, sex, country ); webservicename.singlesummary[] test = new webservicename.singlesummary[1]; test[0] = new webservicename.singlesummary(); // extra line for your code test[0].name= rec.name; test[0].age = rec.age; test[0].dob = dob; test[0].sex = sex; test[0].country = country; </code></pre> <p>Obvously, if you need an array and you have length greater than one, you could replace all but lines one and two above inside a for...next loop and index to the <code>ith</code> element.</p> <p>I notice though, that you're indexing into the array with <code>[0]</code> (and creating an array of length 1) which seems pointless to me, you might as well use a single instance:</p> <pre><code>rec = new Record(name, age, dob, sex, country ); webservicename.singlesummary test = new webservicename.singlesummary(); test.name= rec.name; test.age = rec.age; test.dob = dob; test.sex = sex; test.country = country; </code></pre> <p>If the reason you're using an array of length one is because the service you call only accepts an array/list of items, you can always create one during the call:</p> <pre><code>wbsvcProxy.MethodCall(new List&lt;singlesummary&gt;() { test }); </code></pre> <p>In my opinion, this is more readable throughout your code, since you only build the array/list when you're calling the method and removes all of the funky <code>[0].</code> syntax from the rest of your code (If your method doesn't require it, then never mind this last bit)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload