Member 12741312 Ответов: 0

Динамическое предоставление источника данных и параметров кристаллическому ретранслятору


I have created a crystal report for ERP which shows report from multiple tables. I want same report to be generated using web app . for that I am making dynamic connection to report using code <a href="http://www.c-sharpcorner.com/UploadFile/75ceb2/print-crystal-report-at-client-side-printer-in-Asp-Net/"></a>from here .

but it gives error of database connection error .how ever this code works well for report generating from one table .. If I provide data source using manual functionally of data source providing "when try to view preview" .

then it is bypassing the parameter provided to it  

How can i pass data source and parameter dynamically .....
 any link reference...
thanks in advance ...


Что я уже пробовал:

public void bindCrystal()
{
    string inv_no = DropDownList1.SelectedValue;
    CrystalReportViewer1.Visible = true;

    conn.Open();
    dt = new DataTable();
    dt.TableName = "Crystal Report Example";
    cmd.Connection = conn;
    //string sql = "select * from table";
    cmd.Parameters.Add("@no", inv_no);
    cmd.CommandText = sql;
    sqlda = new SqlDataAdapter(cmd);
    sqlda.Fill(ds);
    ds.Tables[0].Merge(dt);
     rptDoc.Load(Server.MapPath("~/livetest1.rpt"));
    rptDoc.SetDatabaseLogon("sa", "pass", "ip address", "database");
    rptDoc.SetDataSource(ds);
    rptDoc.SetParameterValue("parameter1", inv_no);
    rptDoc.SetParameterValue("parameter2", "inv_cat");
    CrystalReportViewer1.ReportSource = rptDoc;
    conn.Close(); 
       }

0 Ответов