DumDum
DumDum

Reputation: 67

The report you requested requires further information

i create crystal report which ask input from user... i user parameter field that ask start date and end date to get the report...

everything goes right until the user submit their starting and ending date...

the crystal report keep asking the password for the database unless i write it in the code... here my code

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", "P@ssw0rd")
        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", "P@ssw0rd")
        reportdocument.SetParameterValue("Akhir Jam Keluar", Label2.Text)
        CrystalReportViewer1.ReportSource = reportdocument
        CrystalReportViewer1.Visible = True
    Else
        CrystalReportViewer1.Visible = False
    End If
End Sub

Upvotes: 1

Views: 1326

Answers (2)

Usman Khalid Qureshi
Usman Khalid Qureshi

Reputation: 146

I have the same problem but I find a simple solution to it. you just need to replace dataset with the data table and it will work fine..

Upvotes: 1

Hamidreza
Hamidreza

Reputation: 3128

i use this code for oracle connection and i use CRAXDRT.dll for create report in c#, maybe it can help you:

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");
        }

Upvotes: 0

Related Questions