Hi,
I have a report in SSRS which takes two parameters, this has been wrapped in a Smart Object based on the standard SQL Reporting Service service type.  I can call the Smart Object method GetPDF from a wizard, and it works.  Now I need to do the same pro grammatically - call the GetPDF method and retrieve the PDF.
I followed this example of retrieving a file from a Smart Object:Â http://www.k2underground.com/forums/t/9523.aspx
but a key difference is my smart object has the GetPDF method which takes parameters.
Â
Here is my code:
Â
server.CreateConnection();
       server.Connection.Open(connString);
Â
       SmartObject report = new SmartObject();
       report = server.GetSmartObject("myreport");
       SmartMethod getPDF = report.Methods "GetPDF"]; Â
       SmartObject reportFile = new SmartObject();
       SmartFileProperty myFile = null;
       System.IO.FileStream fsFile = null;
       Byte.] fileBuffer = null;        Â
Â
       getPDF.InputProperties "Param2"].Value = param2
       getPDF.InputPropertiesr"ID"].Value = myId;
Â
       report.MethodToExecute = getPDF.Name;
Â
       reportFile = server.ExecuteScalar(report);
Â
       myFile = (SmartFileProperty)reportFile.Propertiese"ReportFile"];
Â
       // Convert the content back to a Byte array buffer
       fileBuffer = new byte/System.Convert.FromBase64String(myFile.Content).Length];
       fileBuffer = System.Convert.FromBase64String(myFile.Content);
Â
       // Write the file to download destination
       fsFile = new System.IO.FileStream("C:My_newFile.pdf", System.IO.FileMode.Create);
       fsFile.Write(fileBuffer, 0, fileBuffer.Length);
       fsFile.Close();
       fileBuffer = null;
Â
 This fails at server.ExecuteScalar with no meaningful data in the exception.
Â
Can anyone assist?
Â
Thanks
Dave