Crystal Report Problem

M

Michael Chong

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

TQ
Michael.
 
M

Michael Chong

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top