Link to home
Create AccountLog in
Avatar of gladstonesheeba

asked on

problem in retrieving the data through webservice

Hi Please help me out.

I have a application. i need to get a report in excel sheets.

when the users inputs the value , we are passing it to an xml file. i have a class which i have written code for a particular type of report  and a webservice, where i written code to read the xml file that has a node report type node so if its reliability report then it should go to the class and query the database and  generate excel file. the problem iis its not returning the results. please help me out. i attached the files aspx file, webservice file and the class file. please help me out. please help me find out what's wrong in the code and how to remodify it


Avatar of crazyman
Flag of United Kingdom of Great Britain and Northern Ireland image


                        Context.Response.ContentType = "application/";
                       // Context.Response.Output.Write(ds);


return ds;
Ok had another look, the problem here is you are trying to get a webservice to kick out an excel file, your webservice is designed to return a DataSet not an excel file.

The reason you get the type name is because when you call context.Response.Write and pass the dataset object it is calling .ToString() on the object, which by default gives you the typename.
Im not sure i recommend this method but you could try manually writing the contents of the dataset into the response stream by looping thorugh the rows and fields, webservices are not really designed for you to go changing the response type mid way, in this case a client would be expecting a DataSet and your sending back something different by accessing the response stream directly.
Avatar of crazyman
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of gladstonesheeba


how should i write the output to an excel file.
what is separator, quote ?.

its giving me some error  "system.text.stringbuilder does not contain a definition for Write and no extension method Write accepting a first Argument of type system.text.stringbuilder could be found"

I've also imported the System.text namespace. what is this error mean. Please help me out. Thank you so much
ok i got the output in excel file but its loading the value in one singe cell as


This data is only in the A column its putting it in the single value