1
Answer

Crystal reports problem

sanjith kumar p

sanjith kumar p

13y
1.2k
1
Dear Sir,

I am creating a crystal report for a department stores.pls tell me the solution for passing the date  values in the forms.the data is not showing in the report page.kindly give the solution for it.

Code :
private void btnprint_Click(object sender, EventArgs e)
  {
  save();

  if (V_Save == true)
  {
 newpri();
  }
  }


public void newpri()
  {
  TableLogOnInfos Crinfo = new TableLogOnInfos();
  TableLogOnInfo CrLog = new TableLogOnInfo();
  ConnectionInfo CrCon = new ConnectionInfo();

  CrCon.ServerName = con.ConnectCrystalServer();
  CrCon.DatabaseName = con.ConnectCrystalTable();
  CrCon.UserID = con.ConnectCrystalUser();
  CrCon.Password = con.ConnectCrystalPW();
  CrystalReport2 CBR = new CrystalReport2();
  foreach (Table crTable in CBR.Database.Tables)
  {
  CrLog = crTable.LogOnInfo;
  CrLog.ConnectionInfo = CrCon;
  crTable.ApplyLogOnInfo(CrLog);
  }

  frmCrySalesbill FCS = new frmCrySalesbill();
  FCS.crystalReportViewer1.ReportSource = CBR;
  string condsr;
  dmy = dtpdate.Value.ToShortDateString();
  //d_y = dmy.Remove(0, 3).ToString().Trim();
  d_y1 = dmy.Remove(5, 0).ToString().Trim();
  //dep_d = dmy.Remove(1, 5).Trim();
  //dep_y = d_y.Remove(0, 2).Trim();
  //dep_m = dmy.Remove(1, 8).Trim();
 

  ason_date = "DateTime (" + d_y1 + ")";


  condsr = "{Sales1.BillNO} =" + Convert.ToInt32(txtbillno.Text) + " and  {Sales1.Date} = " + ason_date;
  FCS.crystalReportViewer1.SelectionFormula = condsr;
  FCS.crystalReportViewer1.Refresh();
  FCS.ShowDialog();
 
  }
 
output:

Answers (1)