Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more: , +
Dear All,


Now am working at c# windows application. Here i have one combobox and

one button in my form. In my combobox have 3 items Table1,Table2,Table3. In my

database have one table ALLTABLE(column of this table is

TableName,CustomerName,Datetime), am save all the 3 tables data at ALLTABLE. Now i

wanna to get Table2 report only from ALLTABLE . So i select Table2 at combobox and

press button. is this my problem. Am did report for whole table but this is my

experience for this type of problem. All replies are welcome.


Thanks & Regards

Dhinesh Kumar.V
Posted
Comments
ssd_coolguy 22-Aug-12 2:45am    
if i correctly understand your problem then...
you just need to pass the parameter to your report..

1 solution

I think this will help you.
C#
private void frm_Load(object sender, EventArgs e)
        {
          
            SqlConnection con = new SqlConnection();
            con.ConnectionString = "Your Connection String Here";
            con.Open();
            SqlDataAdapter da3 = new SqlDataAdapter("Select * from ALLTABLE where TableName='"+combobox1.Text+"'", con);
            DataSet ds3 = new DataSet();
            da3.Fill(ds3, "TableName");
            CrystalReportName abc = new CrystalReportName();
            abc.SetDataSource(ds3.Tables[0]);
            crystalReportViewer1.ReportSource = abc;
            crystalReportViewer1.Refresh();
            con.Close();
        }


any problem revert back
 
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