1
Answer

cryating crystal report with dataset

Pramod Kumar Nandagiri

Pramod Kumar Nandagiri

14y
2.9k
1
hi iam using this code to create crystal reports with dataset but it giving only columns names ,the data not coming only it simply displaying the column names
like this
categoryid   categoryname   Description

i think i shold add the dataset to the datatable of dataset.xsd
i just created a datatable with 3 columns but i don't know how to fill tthe datatable(mydatatable) on dataset1.xsd form
please help me on this

this is my code
 private void Form1_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection();
            con.ConnectionString = ConfigurationSettings.AppSettings["conn"];
            string strsql = "select categoryid,categoryname,description from categories";
            SqlDataAdapter cmd = new SqlDataAdapter(strsql, con);
            DataSet ds = new DataSet();
            cmd.Fill(ds);
            CrystalReport1 myDataReport = new CrystalReport1();
            myDataReport.SetDataSource(ds,"mydatatable");
            crystalReportViewer1.ReportSource = myDataReport;

        }

Answers (1)