|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
reporting services 2000 renderingget the render method to work for my reports (http://help.maximumasp.com/SmarterTicket/Customer/KBArticle.aspx?articl eid=847). I get serveral errors such as : 1) The best overloaded match has some invalid arguments 2) Argument '8': cannot convert from '<null>' to 'out string' 3) Argument '9': cannot convert from '<null>' to 'out string' 4) Argument '10': cannot convert from '<null>' to 'out lovelyjubbly.net.discountasp.rs.ParameterValue[]' 5) Argument '11': cannot convert from '<null>' to 'out lovelyjubbly.net.discountasp.rs.Warning[]' 6) Argument '12': cannot convert from 'string[]' to 'out string[]' Can anybody help? Cheers, Mike *** Sent via Developersdex http://www.developersdex.com *** You'll get these errors if you don't pass the arguments properly to the
Render method. Make sure you specify the 'out' keyword for output parameters and pass strongly-typed parameters instead of 'null' when required. If you still have problems, post your code. -- Show quoteHope this helps. Dan Guzman SQL Server MVP "Mike P" <mike.p***@gmail.com> wrote in message news:eMxayzaVGHA.4764@TK2MSFTNGP10.phx.gbl... >I am using SQL Server 2000 sp3 and reporting services sp2, and I cannot > get the render method to work for my reports > (http://help.maximumasp.com/SmarterTicket/Customer/KBArticle.aspx?articl > eid=847). > > I get serveral errors such as : > > 1) The best overloaded match has some invalid arguments > 2) Argument '8': cannot convert from '<null>' to 'out string' > 3) Argument '9': cannot convert from '<null>' to 'out string' > 4) Argument '10': cannot convert from '<null>' to 'out > lovelyjubbly.net.discountasp.rs.ParameterValue[]' > 5) Argument '11': cannot convert from '<null>' to 'out > lovelyjubbly.net.discountasp.rs.Warning[]' > 6) Argument '12': cannot convert from 'string[]' to 'out string[]' > > Can anybody help? > > > Cheers, > > Mike > > > > > *** Sent via Developersdex http://www.developersdex.com *** Hi Dan,
Here is my first attempt : // ReportingService rs = new ReportingService(); // // rs.Credentials = new System.Net.NetworkCredential("rs_*****", "*****", ""); // // Byte[] results, image; // string[] streamids; // string streamid; // // //render the report to HTML 4.0 // results = rs.Render("/lovelyjubbl/reports/QBRatings", "HTML4.0", null, "<DeviceInfo><StreamRoot>/lovelyjubbly/</StreamRoot></DeviceInfo>", null, null, null, null, null, null, null, streamids); // Response.BinaryWrite(results); And here's my second : ReportingService rs = new ReportingService(); rs.Credentials = new System.Net.NetworkCredential("rs_*****", "*****", ""); // Render arguments byte[] result = null; string reportPath = "/lovelyjubbl/reports/QBRatings"; string format = "MHTML"; string historyID = null; string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; // Prepare report parameter. // ParameterValue[] parameters = new ParameterValue[3]; // parameters[0] = new ParameterValue(); // parameters[0].Name = "EmpID"; // parameters[0].Value = "38"; // parameters[1] = new ParameterValue(); // parameters[1].Name = "ReportMonth"; // parameters[1].Value = "6"; // June // parameters[2] = new ParameterValue(); // parameters[2].Name = "ReportYear"; // parameters[2].Value = "2004"; DataSourceCredentials[] credentials = null; string showHideToggle = null; string encoding; string mimeType; Warning[] warnings = null; ParameterValue[] reportHistoryParameters = null; string[] streamIDs = null; SessionHeader sh = new SessionHeader(); rs.SessionHeaderValue = sh; try { result = rs.Render(reportPath, format, historyID, devInfo, null, credentials, showHideToggle, out encoding, out mimeType, out reportHistoryParameters, out warnings, out streamIDs); } catch (SoapException e) { //Console.WriteLine(e.Detail.OuterXml); } // Write the contents of the report to an MHTML file. try { FileStream stream = File.Create( "report.mhtml", result.Length ); Console.WriteLine( "File created." ); stream.Write( result, 0, result.Length ); Console.WriteLine( "Result written to the file." ); stream.Close(); } catch ( Exception e ) { //Console.WriteLine( e.Message ); } Neither of which work, and both give errors as mentioned in my first post. Thanks, Mike *** Sent via Developersdex http://www.developersdex.com *** > Neither of which work, and both give errors as mentioned in my first The first version will generate the errors mentioned in your initial post. > post. However, your second attempt looks syntactically correct. I copy/pasted that code and successfully compiled it so you shouldn't get any errors as long as you've added the RS web service reference to your project. Did you completely remove the first version from your project? -- Show quoteHope this helps. Dan Guzman SQL Server MVP "Mike P" <mike.p***@gmail.com> wrote in message news:ON09ocbVGHA.5288@TK2MSFTNGP14.phx.gbl... > Hi Dan, > > Here is my first attempt : > > // ReportingService rs = new ReportingService(); > // > // rs.Credentials = new System.Net.NetworkCredential("rs_*****", > "*****", ""); > // > // Byte[] results, image; > // string[] streamids; > // string streamid; > // > // //render the report to HTML 4.0 > // results = rs.Render("/lovelyjubbl/reports/QBRatings", "HTML4.0", > null, > "<DeviceInfo><StreamRoot>/lovelyjubbly/</StreamRoot></DeviceInfo>", > null, null, null, null, null, null, null, streamids); > // Response.BinaryWrite(results); > > > > And here's my second : > > ReportingService rs = new ReportingService(); > rs.Credentials = new System.Net.NetworkCredential("rs_*****", "*****", > ""); > > // Render arguments > byte[] result = null; > string reportPath = "/lovelyjubbl/reports/QBRatings"; > string format = "MHTML"; > string historyID = null; > string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; > > // Prepare report parameter. > // ParameterValue[] parameters = new ParameterValue[3]; > // parameters[0] = new ParameterValue(); > // parameters[0].Name = "EmpID"; > // parameters[0].Value = "38"; > // parameters[1] = new ParameterValue(); > // parameters[1].Name = "ReportMonth"; > // parameters[1].Value = "6"; // June > // parameters[2] = new ParameterValue(); > // parameters[2].Name = "ReportYear"; > // parameters[2].Value = "2004"; > > DataSourceCredentials[] credentials = null; > string showHideToggle = null; > string encoding; > string mimeType; > Warning[] warnings = null; > ParameterValue[] reportHistoryParameters = null; > string[] streamIDs = null; > SessionHeader sh = new SessionHeader(); > rs.SessionHeaderValue = sh; > > try > { > result = rs.Render(reportPath, format, historyID, devInfo, null, > credentials, > showHideToggle, out encoding, out mimeType, out > reportHistoryParameters, out warnings, > out streamIDs); > } > catch (SoapException e) > { > //Console.WriteLine(e.Detail.OuterXml); > } > // Write the contents of the report to an MHTML file. > try > { > FileStream stream = File.Create( "report.mhtml", result.Length ); > Console.WriteLine( "File created." ); > stream.Write( result, 0, result.Length ); > Console.WriteLine( "Result written to the file." ); > stream.Close(); > } > catch ( Exception e ) > { > //Console.WriteLine( e.Message ); > } > > > Neither of which work, and both give errors as mentioned in my first > post. > > > Thanks, > > Mike > > *** Sent via Developersdex http://www.developersdex.com *** I'm now using the second version of my code. I no longer get build
errors, but when I run the code I just get an unviewable image (a blank image with a red cross). The strange thing is that my code works for PDF, but not HTML4.0. ReportingService rs = new ReportingService(); rs.Credentials = new System.Net.NetworkCredential("****", "****", ""); // Render arguments byte[] result = null; string reportPath = "/lovelyjubbl/reports/QBRatings"; string format = "HTML4.0"; string historyID = null; string devInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; DataSourceCredentials[] credentials = null; string showHideToggle = null; string encoding; string mimeType; Warning[] warnings = null; ParameterValue[] reportHistoryParameters = null; string[] streamIDs = null; SessionHeader sh = new SessionHeader(); rs.SessionHeaderValue = sh; try { result = rs.Render(reportPath, format, historyID, devInfo, null, credentials, showHideToggle, out encoding, out mimeType, out reportHistoryParameters, out warnings, out streamIDs); } *** Sent via Developersdex http://www.developersdex.com *** Try setting devInfo to null per http://support.microsoft.com/kb/842854/.
-- Show quoteHope this helps. Dan Guzman SQL Server MVP "Mike P" <mike.p***@gmail.com> wrote in message news:%23eq76ymVGHA.1688@TK2MSFTNGP11.phx.gbl... > I'm now using the second version of my code. I no longer get build > errors, but when I run the code I just get an unviewable image (a blank > image with a red cross). The strange thing is that my code works for > PDF, but not HTML4.0. > > ReportingService rs = new ReportingService(); > rs.Credentials = new System.Net.NetworkCredential("****", "****", > ""); > > // Render arguments > byte[] result = null; > string reportPath = "/lovelyjubbl/reports/QBRatings"; > string format = "HTML4.0"; > string historyID = null; > string devInfo = > @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"; > > DataSourceCredentials[] credentials = null; > string showHideToggle = null; > string encoding; > string mimeType; > Warning[] warnings = null; > ParameterValue[] reportHistoryParameters = null; > string[] streamIDs = null; > SessionHeader sh = new SessionHeader(); > rs.SessionHeaderValue = sh; > > try > { > result = rs.Render(reportPath, format, historyID, devInfo, null, > credentials, > showHideToggle, out encoding, out mimeType, out > reportHistoryParameters, out warnings, > out streamIDs); > } > > > *** Sent via Developersdex http://www.developersdex.com *** This just gives me a blank page on rendering.
*** Sent via Developersdex http://www.developersdex.com *** > This just gives me a blank page on rendering. I'm not sure what you mean by a blank page since your last code snippet writes the report to a file rather than a browser window. If your code is part of an ASP.NET application, you could change the format to "HTML4.0" and render it with the code below. Response.ClearContent(); Response.BinaryWrite(result); Response.Flush(); Response.Close(); My RS expertise is limited. You might try posting rendering issues to a Reporting Services forum. -- Show quoteHope this helps. Dan Guzman SQL Server MVP "Mike P" <mike.p***@gmail.com> wrote in message news:OLZEjbnVGHA.4384@tk2msftngp13.phx.gbl... > This just gives me a blank page on rendering. > > > > *** Sent via Developersdex http://www.developersdex.com *** |
|||||||||||||||||||||||