Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i pass an array and a string variable at a time which have 'sessiontoken' and '{Name,Age,DOB,Qualification}' e.g '8b563bdb-2b41-4169-97dc-dd15d46ffb6b','{''Ranjit',23,'23-03-1988','B.Tech'',''Swapnil',24,'04-07-1989''}' in webmethod of a webservice????

plz help me....
Posted

1 solution

This is not a specific solution, a workaround only.

1. Keep the webmethod to accept string parameter.

2. Preparing Tagging for webmethod parameter as :
C#
string parameters = string.Format("{0}[#sp#]{1}[#sp#]{2}[#sp#]{3}[#sp#]{4}[#sp#]{5}[#sp#]{6}[#sp#]{7}", s1, s2, s3, s4, s5, s6, s7, s8);

here s1 s2 s3, s4..s8 etc are the
'8b563bdb-2b41-4169-97dc-dd15d46ffb6b'
'Ranjit'
23
23-03-1988
'B.Tech'
'Swapnil'
24
'04-07-1989'

Now in the WebMethod split them to required parameters :
C#
  string[] sep = new string[] { "[#sp#]" };
string[] Temp = stringparam.Split(sep, StringSplitOptions.None);
s1 = Temp[0];
s2 = Temp[1];
...
s8 = Temp[7];
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900