Reports with no records

Tips submitted by ASP.NET Maker users

Reports with no records

Postby pel » Wed Jul 25, 2012 3:44 am

If you create a report with ASP.NET Maker and a user tries to run the report before any records have been added the system will error out. To avoid that problem you can make a simple change to aspxfn.vb (or aspxfn.cs if you're using C# coding) in the template file. Just add a "try...catch...end try" clause to the GetRows function:

Change from: Public Overloads Function GetRows(ByRef dr As OleDbDataReader) As ArrayList
Dim Rows As New ArrayList()
While dr.Read()
Rows.Add(GetRow(dr))
End While
Return Rows
End Function

to: Public Overloads Function GetRows(ByRef dr As OleDbDataReader) As ArrayList
Dim Rows As New ArrayList()
Try
While dr.Read()
Rows.Add(GetRow(dr))
End While
Catch
End Try
Return Rows
End Function
pel
 

Return to User Submited Tips (ASP.NET Maker)



cron