Quantcast
Channel: Crystal Reports
Viewing all articles
Browse latest Browse all 1507

How to search crystal report from text box wiht different id's

$
0
0

i want to search report  with three different column ID 

ID

National ID

Patient number

i can search from one ID  i want to search record in crystal report from three different ID 

this is my code 

  SqlCommand cmd = new SqlCommand();
        SqlDataAdapter da = new SqlDataAdapter();
        DataTable dt = new DataTable();
        DataTable dt1 = new DataTable();
string query;
            try
            {
                con.Open();
                query = "select * from Transactions where idcount ='" + TextBox1.Text + "'";
                cmd = new SqlCommand(query, con);
                da = new SqlDataAdapter(cmd);
                dt.Clear();
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {

                    ReportDocument Report = new ReportDocument();
                    Report.Load(Server.MapPath("~/CrystalReport.rpt"));
                    Report.SetDataSource(dt);
                    query = "select * from Transactions where idcount ='" + TextBox1.Text + "'";
                    cmd = new SqlCommand(query, con);
                    da = new SqlDataAdapter(cmd);
                    dt1.Clear();
                    da.Fill(dt1);
                   
                    Report.SetDatabaseLogon("sa", "123456789", @"TRAINING-ROOM-8", "newMreport");
                    CrystalReportViewer1.ReportSource = Report;
                    CrystalReportViewer1.ReportSource = Report;
                    CrystalReportViewer1.DataBind();
                    
                }
            }




Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>