on 04-28-2015 10:19 PM
The error discussed in this post http://scn.sap.com/thread/1890650 seems to have crept back into SP12. The following code:
Using dbConnection As SqlConnection = GetNewSQLConnection()
.AddLoginInfo(dbConnection)
If TypeOf .Report Is IHasParameters Then
DirectCast(.Report, IHasParameters).ApplyParameterValues()
End If
If .Report.Rows.Count > 0 Then
.PrintToPrinter(.PrinterPageSettings.PrinterSettings.Copies, False, _
.PrinterPageSettings.PrinterSettings.FromPage, _
.PrinterPageSettings.PrinterSettings.ToPage)
.
.
.
Gives the error at If .Report.Rows.Count > 0
Type 'System.String' cannot be marshaled as an unmanaged structure; no meaningful size or offset can be computed.
The report does contain a blob - I tried deleting it and dragging it from the table - again, but the same error appears before and after. The type of the Field object is IFieldBlob. Oddly enough, other reports that also contain this field, currently seem to be working, although we will have to revisit all of them now.
I am using VS2010 and SQL Server 2005.
Any help would be appreciated.
Don't use SP 12. Update to SP 13 and test.
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow me on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did that. No joy. BTW, the report preview shows the report with no problems - it is only when I try and check on the number of records that this occurs. I installed SP13, the file dates all show 27/01/2015.
If you don't count the number of records, e.g. catch it in the debugger and step over that point, then the report prints fine. The workaround seems to be to waste a bunch of paper. I will have to comment that line out in order for the application to work.
Neil
Partial work-around:
''' <summary>
''' This function is a workaround of the Crystal Reports bug that causes a report with an image in it
''' to fail when the report is checked if it has data.
''' </summary>
''' <param name="Report">Report to check</param>
''' <returns>Number of rows in the report</returns>
''' <remarks>If the check throws an exception a value of one will be returned.</remarks>
Friend Function GetReportRowsCount(Report As ReportClass) As Integer
Try
Return Report.Rows.Count
Catch ex As Exception
My.Application.Log.WriteException(ex, TraceEventType.Warning, "GetReportRowsCount for " & Report.Name)
Return 1
End Try
End Function
I use this function in place of the check for Report.Rows.Count,
This allows most of my reports to work correctly, but allows the odd blank report with an image on it to print. Oddly enough, some of the older reports with logo's on them seem to work correctly. The newer ones run into this problem.
Neil
Hi Neil,
There have been updates to CR Designer and the embedded Designer built into VS.
Can you try updating one of those reports in VS or if you have the full CR Designer 2008 or above update it in there and test.
Can you attach a few of your reports so I can run them through my app and see what happens?
Use the Advanced editor option, add the reports to a zip file and then rename the zip file to *.txt and then attach. You can't attach a zip file...
Thanks
Don
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.