2012-12-07 52 views

回答

1

進口CrystalDecisions.Shared 進口CrystalDecisions.CrystalReports.Engine

昏暗crTableLogonInfos作爲新TableLogOnInfos 暗淡crTableLogonInfo As New TableLogOnInfo Dim crConnectionInfo As New ConnectionInfo

Dim crTables As Tables 
Dim crTable As Table 

Dim crReport As CrystalDecisions.CrystalReports.Engine.ReportClass 

昏暗crReportDocuments作爲新YourReport(晶體報告) crReportDocuments.SetParameterValue( 「@參數」,的parameterValue) .. ..

隨着crConnectionInfo ''(連接信息) .ServerName =服務器 .DatabaseName = DATABASENAME 如果的Uid <> 「」 那麼 .UserID =的Uid 。密碼= PWD 否則 .IntegratedSecurity =真 結束如果結束 隨着

 crTables = crReport.Database.Tables 

     For Each crTable In crTables 
      crTableLogonInfo = crTable.LogOnInfo 
      crTableLogonInfo.ConnectionInfo = crConnectionInfo 
      crTable.ApplyLogOnInfo(crTableLogonInfo) 
     Next 

     cry.ReportSource = crReportDocuments 
0

首先,將開始日期和結束日期參數添加到報告中。然後在「選擇專家」中,將其設置爲使您的日期字段在參數{@Start Date}{@End Date}之間。

你可能想看看這個以幫助.NET和晶體之間傳遞參數: Parameter to Crystal Report