Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: No Data in Report Post Reply Post New Topic
Author Message
dextar
Newbie
Newbie
Avatar

Joined: 27 Feb 2008
Online Status: Offline
Posts: 2
Quote dextar Replybullet Topic: No Data in Report
    Posted: 27 Feb 2008 at 8:28pm
I am new to crystal reports , i am using crytal reports to display data in a asp.net form . on basis of selection from the dropdown i fill a table in database having same structure as of in .Xsd file , then assign the data set to report datasource . report is loading but the data is not coming
kindly help


code

            int sbu = Convert.ToInt32(ddl1.SelectedItem.Value);
            report=new CrystalReport1();
            string conn1 = "  ";
            SqlConnection conn = new SqlConnection(conn1);
            conn.Open();
            SqlDataAdapter da = new SqlDataAdapter("sp_cis",conn);
           
            DataSet Dataset1 = new DataSet();
            DataTable Temp = Dataset1.Tables.Add();
//            Dataset1.Tables.Add("CISTemp");
            Temp.TableName="CISTemp";
            SqlCommand cmd = new SqlCommand("sp_cis",conn);
            cmd.CommandType= CommandType.StoredProcedure ;
            cmd.Parameters.Add( new SqlParameter("@hlevelid",sbu));
            da.SelectCommand=cmd;
            da.Fill(Dataset1,"CISTemp");
            CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument;
            myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            myReportDocument.Load(Server.MapPath("CrystalReport1.rpt"));
             myReportDocument.SetDataSource(Dataset1);
            CrystalReportViewer1.ReportSource = myReportDocument;
            CrystalReportViewer1.DataBind();
            conn.Close();

Thanks in advance

IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 28 Feb 2008 at 11:45am

Try this:

int sbu = Convert.ToInt32(ddl1.SelectedItem.Value);
report=new CrystalReport1();
string conn1 = "  ";
SqlConnection conn = new SqlConnection(conn1);
conn.Open();
           
DataSet Dataset1 = new DataSet();
DataTable Temp = new DataTable("CISTemp");
SqlCommand cmd = new SqlCommand("sp_cis",conn);
cmd.CommandType= CommandType.StoredProcedure ;
cmd.Parameters.Add( new SqlParameter("@hlevelid",sbu));
Temp.Load(cmd);
Dataset1.Add(Temp);
CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument;
myReportDocument = new 
     CrystalDecisions.CrystalReports.Engine.ReportDocument();
myReportDocument.Load(Server.MapPath("CrystalReport1.rpt"));
myReportDocument.SetDataSource(Dataset1);
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DataBind();
conn.Close();
Also, is your report designed using the "CISTemp" table name?  If not, that could also be part of your problem.  Even though you're assigning the Datasource to the report, the report won't work if the table names don't match up.
 
-Dell


Edited by hilfy - 28 Feb 2008 at 11:48am
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.