Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am trying to create a WCF web service and it is working fine while passing single parameter. But not sure how to loop through multiple records.

For example i am able to send the parameter as 1 and the return value is working perfectly fine. But when i send multiple input parameters like 1,2 i am getting the error. Please find the code i am using. It would be helpful somebody could help me on this.


using (DbDataReader reader = command.ExecuteReader())
{

while (reader.Read())
{

Testdata.Id= Convert.ToInt32(reader[0]);
Testdata.prd = Convert.ToInt32(reader[1]);
Testdata.fran = Fra.ToString();
Testdata.TP = Tf.ToString();

}
}
Posted
Comments
KaushalJB 22-Sep-14 1:17am    
Provide the exact code that you use. This code is of no use to find out your problem. Are you using json or xml ? How do you pass values ?

Thanks Kaushal,

I am using this sample application as is the web service. And issue is with loop(it is not an issue more like logic to be changed to return multiple rows).

Simple Metro Style Application with WCF service and MS Excel Database[^]
 
Share this answer
 
Any idea or work around for the solution
 
Share this answer
 

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