2013-10-24 32 views
1

我創建水晶報表,其要求來自用戶的輸入...我的用戶參數字段要求開始日期和結束日期得到報告......您請求的報告需要進一步的信息

一切正常,直到用戶提交他們的起始和結束日期...

的水晶報表不斷地問數據庫的密碼,除非我在代碼中寫......我在這裏的代碼

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click 
    If DropDownList1.SelectedValue = "Jam Masuk" Then 
     Dim reportdocument As New ReportDocument() 
     reportdocument.Load("D:\MIS Project\Master Project MIS\BSTM\Security\ReportTamuMasuk.rpt") 
     reportdocument.SetDatabaseLogon("sa", "[email protected]") 
     reportdocument.SetParameterValue("Akhir Jam Masuk", Label2.Text) 
     CrystalReportViewer1.ReportSource = reportdocument 
     CrystalReportViewer1.Visible = True 
    ElseIf DropDownList1.SelectedValue = "Jam Keluar" Then 
     Dim reportdocument As New ReportDocument() 
     reportdocument.Load(Server.MapPath("ReportTamuKeluar.rpt")) 
     reportdocument.SetDatabaseLogon("sa", "[email protected]") 
     reportdocument.SetParameterValue("Akhir Jam Keluar", Label2.Text) 
     CrystalReportViewer1.ReportSource = reportdocument 
     CrystalReportViewer1.Visible = True 
    Else 
     CrystalReportViewer1.Visible = False 
    End If 
End Sub 
+0

這可能是數據連接器問題。你連接的是什麼類型的數據庫? –

+0

同類問題:http://stackoverflow.com/questions/1186048/crystal-reports-the-report-you-requested-requires-further-information?rq=1 – Andrew

回答

0

我用這個代碼Oracle連接我使用CRAXDRT.dll在c#中創建報告,也許它可以幫助你:

CRAXDRT.DatabaseTable T; 
     for (int i = 1; i <= report1.Database.Tables.Count; i++) 
     { 
      T = (CRAXDRT.DatabaseTable)report1.Database.Tables[i]; 
      CRAXDRT.ConnectionProperties cps = T.ConnectionProperties; 
      CRAXDRT.ConnectionProperty cp = 
       (CRAXDRT.ConnectionProperty)cps["User ID"]; 
      cp.Value = "Username";//DB.Username; 

      cp = (CRAXDRT.ConnectionProperty)cps["Password"]; 
      cp.Value = "Password";// DB.Password; 

      cp = (CRAXDRT.ConnectionProperty)cps["Data Source"]; 
      cp.Value = "DataSource";//DB.DataSource; 

      T.SetLogOnInfo("DataSource", "", "Username", "Password"); 
     } 
1

我有同樣的問題,但我找到了一個簡單的解決方案。你只需要用數據表替換數據集,它就會正常工作。

相關問題