thanks
crystal report
i want a complete code for crystal report to filter the data by maximum present in database.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Jul 12, 2012, 3:26 AM
Try
CrystalReport1 r1 = new CrystalReport1();
private void button2_Click(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "select * from product where price=(select max(price) from product)";
com = new OleDbCommand(str, con);
oledbda = new OleDbDataAdapter(com);
ds = new DataSet();
oledbda.Fill(ds, "product");
dataGridView1.DataMember = "product";
dataGridView1.DataSource = ds;
con.Close();
r1.SetDataSource(ds);
CrystalReportViewer1.ReportSource = r1;
CrystalReportViewer1.RefreshReport();
CrystalReportViewer1.Refresh();
}Thanks