Crystal Report Problem

  • Thread starter Thread starter Michael Chong
  • Start date Start date
M

Michael Chong

How can I change the sql query in my crystal report document during runtime?

TQ
Michael.
 
My problem is the report doesn't follow as my code below, it just follow
whatever I have set during the design time. How do I override the existing
query. My following codes are as follow:

Dim StrSQL As String

StrSQL = "SELECT cRef FROM TblCaveat WHERE ID = 2"

Dim da1 As OleDb.OleDbDataAdapter

da1 = New OleDb.OleDbDataAdapter(StrSQL, OleDbConnCaveat)

Dim ds As DataSet

ds = New DataSet("DataSetTmp")

da1.Fill(ds, "DataSetTmp")

RPT.SetDataSource(ds)

RPT.Database.Tables(0).SetDataSource(ds)

CrystalReportViewer1.ReportSource = RPT
 
Back
Top