Dear Sir/Madam,
I have used belowcode but during binding data to dataset i want to use where condition in my sql query. I have tried the same but it gives all results means where condition is not working.
e.g.-
using System;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ReportDocument reportdocument = new ReportDocument();
reportdocument.Load(Server.MapPath("~/CrystalReport.rpt"));
UserInformation dsCustomers = new UserInformation();
using (SqlConnection con = new SqlConnection("Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB"))
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from userinformation where UserId=50", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dsCustomers,"UserInfo");
con.Close();
}
reportdocument.SetDataSource(dsCustomers);
CrystalReportViewer1.ReportSource = reportdocument;
}
}
}
after writing this code in .cs file expeted result is rows which has UserId=50 but in report all rows are displaying.
Please help me out from this issue.
Thanks in advance