水晶报表数据传递的问题

阿泰,不知道怎么用查询语句来向报表传递数据,请你指教!
有朋友教我用cn.execute(sql)来做,我把它写成:
Dim capp As New CRAXDRT.Application
Dim carp As New CRAXDRT.Report
Dim CRXD As CRAXDRT.DatabaseFieldDefinition

Private Sub Command1_Click()
dim sql as string
Set carp = capp.OpenReport(App.Path & "\BookInfo.rpt")
sql="select * from Maintb,Detailtb,Detailtb1 where LOTNO='"&trim(txtLOTNO.text)&"'"
rs=cn.exe(sql)
carp.Database.Tables(1).SetDataSource rs
carp.ParameterFields.GetItemByName("CR").AddCurrentValue (Text1)
CRViewer91.ReportSource = carp
CRViewer91.ViewReport
End sub

运行试过,不行
posted @ 2005-08-08 09:39  阿泰  阅读(642)  评论(15)    收藏  举报