Consider this scenario:
1. I have a dataset called "ds" with a datatable called "dt" containing only the column "A".
2. I create the report object, "regdata" the dataset, call the designer then i programmatically save the layout.
3. I have a dataset called "ds" with a datatable called "dt" containing only the column "B"
4. I load the report layout previously saved in step 2, "regdata" the (new) dataset, call the designer: i find two columns in the datasource, "A" (that doesn't exist anymore in my dataset) and "B". I only want to see "B".
This is the code:
Code: Select all
'STEP 1
Dim ds As DataSet
ds = New DataSet
ds.DataSetName = "ds"
Dim dt As DataTable
dt = New DataTable
dt.TableName = "dt"
dt.Columns.Add("A")
ds.Tables.Add(dt)
'STEP 2
Dim rpt As Stimulsoft.Report.StiReport
rpt = New Stimulsoft.Report.StiReport
rpt.RegData(ds)
'IN THE DESIGNER DATASOURCE I CORRECTLY SEE
'THE DATASOURCE WITH THE COLUMN "A" ONLY
rpt.Design()
rpt.Save("c:\\test.mrt")
rpt = Nothing
'STEP 3
ds = New DataSet
ds.DataSetName = "ds"
dt = New DataTable
dt.TableName = "dt"
dt.Columns.Add("B")
ds.Tables.Add(dt)
'STEP 4
rpt = New Stimulsoft.Report.StiReport
rpt.RegData(ds)
rpt.Load("c:\\test.mrt")
'NOW IN THE DESIGNER DATASOURCE I WILL
'SEE THE COLUMN "A" THAT IN MY DATASET
'DOESN'T EXIST ANYMORE, I WANT TO SEE
'ONLY THE COLUMN "B"
rpt.Design()

This is the designer datasource the second time, i don't want the column "A" because it doesn't exist anymore in the datatable:

Thanks.