Good day,
I am writing my sqlReport class in my project..The thing is, my dataset is designed to accept any field, any datatype, and then shows the result of the sql query to the crystalreportviewer. But then I am stuck with this problem. I will try my best to explain why I'm stuck in it.
Please take a look at my dataset.xsd.
and here's my sqlreport.rpt.
annndd.. this is my class that will populate the dataset and then pass the values to crystal report columns.
Code:
Public Function rptSQL(ByVal CrystalReportViewer As CrystalReportViewer, ByVal fields_As As String()) As sqlreport
Dim objRpt As New sqlreport
Dim server As New servercon
Dim ds As New sqlDataset
Dim cnn As MySqlConnection
'There are more lines of code here
In the code highlighted above, What if I want to target a new crystal report design? I have 5 crystal report designs, and all of those reports uses the same function, but I rename the function, and give a new reportname. Take a look at this code below:
Code:
Public Function rptSQL1(ByVal CrystalReportViewer As CrystalReportViewer, ByVal fields_As As String()) As sqlreport
'code of lines here
End Function
Public Function rptSQL2(ByVal CrystalReportViewer As CrystalReportViewer, ByVal fields_As As String()) As anotherReport
'code of lines here
End Function
Public Function rptSQL3(ByVal CrystalReportViewer As CrystalReportViewer, ByVal fields_As As String()) As ironReport
'code of lines here
End Function
Is there a way I could say something like this:
Code:
Public Function rptSQL(ByVal CrystalReportViewer As CrystalReportViewer, ByVal fields_As As String()) As Any Report I Want
So that I will not duplicate the functions. Thank you for your time reading.
-JL