Error In Binding Data To Crystal Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sureshgv
    New Member
    • Oct 2006
    • 19

    Error In Binding Data To Crystal Report

    SqlConnection cn=new SqlConnection ("User ID=sa;Initial Catalog=usermod ule;Data Source=NEW5");
    SqlDataAdapter da=new SqlDataAdapter (Application["str1"].ToString(),cn) ;
    DataSet ds=new DataSet();
    da.Fill (ds,"REGISTER,I NOUTDETAILS");

    CrystalReport1 cr=new CrystalReport1( );
    cr.SetDataSourc e(ds.Tables[0]);
    CrystalReportVi ewer1.ReportSou rce=cr;
    The above statement represents binding data to crystal reports.

    My problem is I am getting error in this statement

    cr.SetDataSourc e(ds.Tables[0]);
    The error is Invalid table no.

    What is the correct statement.

    please help me.........
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    Whats the Error u had got ?

    :)

    Comment

    • anaphaxeon
      New Member
      • Oct 2006
      • 30

      #3
      Instead of using a dataset, try using a DataTable you can use this
      DataTable dt = new DataTable();
      da.Fill(dt);
      then bind the report to that datatable. Alternatively, instead of using the Index of the table you could use the keyname of the datatable for example
      ds.Tables["REGISTER,INOUT DETAILS"]

      Comment

      Working...