Click here to Skip to main content
12,761,018 members (30,311 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
Respected to all,
how to add two tables in .rpt file, which has primary n foreign key relation.

And display particular value in crystalReportViewer.

This is my sql statement:
"Select Material_Master.Material_Name,Purchase.Date,Purchase.Qty,Purchase.Each_Price,Purchase.Warehouse from Purchase,Material_Master where Purchase.Material_Code=Material_Master.Material_Code AND Sr_No='"+TextBox1.Text+"'"

==>problem is that it dont display that particular values ,it display all values.

pls give me some guideline..

Posted 31-Jan-13 0:15am
Updated 31-Jan-13 0:41am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

check this example

private void button1_Click(object sender, EventArgs e)
            SqlConnection cnn ;
            string connectionString = null;
            string sql = null;

            connectionString = "data source=SERVERNAME;initial catalog=DATABASENAME;user id=USERNAME;password=PASSWORD;";
            cnn = new SqlConnection(connectionString);
            sql = "SELECT Product_id,Product_name,Product_price FROM Product";
            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
            DataSet1 ds = new DataSet1();
            dscmd.Fill(ds, "Product");
            MessageBox.Show (ds.Tables[1].Rows.Count.ToString());

            CrystalReport1 objRpt = new CrystalReport1();
            crystalReportViewer1.ReportSource = objRpt;

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100