Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display the record in crystal report.
C#
CrystalReport2 obj = new CrystalReport2();
                SqlConnection con = new SqlConnection();
             //This is connection class that return string.
                ConnectionClass cc = new ConnectionClass();
                con.ConnectionString = cc.GetConnection();
                con.Open();
                //ds = new DataSet();
                DataSet2 ds = new DataSet2();
                SqlDataAdapter da = new SqlDataAdapter("Select * from Sample", con);
                SqlCommandBuilder builder = new SqlCommandBuilder(da);
                da.Fill(ds, "Sample");
                obj.SetDataSource(ds);
                crystalReportViewer1.ReportSource = obj;


This code is not working..
Plz help me......
Thanks in advance!
Posted

1 solution

XML
Hai Friend,use this statement to set the datasource

   obj.SetDataSource(ds.Tables[0]);
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900