I finally did it.
For those who would like to know how, or for a better StackOverFlow.com
experience, I am glad to share the solution.
After reading this great article, I was inspired by the solution and was able to accomplish the desired result by
1-Replacing the FormulaFields with an ADO dataset
containing the same number of columns
I did that by creating a new DataSet in VS.2008 and named it adoDataSet
. Then added all required column names to it (No linking to the actual data at this point as the data will be pulled dynamically later. This is just like a template for the data only). By default, all columns will be String typed, but that okay for my case.
3- In Crystal Reports, I used DataBase Expert to pull the mentioned dataset into the report and replaced the locations of the formula fields with the columns from the adoDataSet
4- Then in my code to populate the formulafields with data, I just called the same function that takes an SQL query and returns a normal OracleClient data set (so it might return multiple rows as desired)
5- This dataset however can not be used directly with Crystal Reports, so it must be first converted to the same type of the adoDataSet
created earlier. so a simple TryCast
did that for me.
Dim sql As String = ""
sql = " SELECT * from table1 where input_id = '" & INPUT_NUMBER & "'"
Dim ds As DataSet = getTable(sql)
Dim orpt As New CrystalReport3
CrystalReportViewer1.ReportSource = orpt
dim ds1 as New adoDataSet
ds1 = TryCast(ds,adoDataSet) ' ds is based on OracleClient data set
' while adoDataSet is the one CrystalReports likes to use
orpt.SetDataSource(ds1)
from there I was able to generate as much copies as I wanted because I own the data, and can cause the data to appear as many times as I like.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…