Click here to Skip to main content
15,915,160 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends

I have create one view in sql and now I want to show that Join value in crystal report in c# GUI window application. please help me

Thanks
Posted

1 solution

step 1: Create crystal report in your project.
step 2: Write select query for View.
C#
public DataTable selectallrecord()
       {   DataSet DS = new DataSet();
           string USER = "";
           USER = "SELECT * FROM StudentInfo";
           SqlDataAdapter DA = new SqlDataAdapter(USER, cn);
           DA.Fill(DS);
           DataTable DT = DS.Tables[0];
           return DT;

       }




step 3: On Button click event bind with crystal report.
C#
private void button1_Click(object sender, EventArgs e)
       {
           DataTable dt = new DataTable();
           dt = selectallrecord();
           CrystalReport1 cr1 = new CrystalReport1();
           cr1.SetDataSource(dt);
           crystalReportViewer1.ReportSource = cr1;
       }
 
Share this answer
 

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