-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSalesreport.aspx.cs
More file actions
45 lines (41 loc) · 1.39 KB
/
Copy pathSalesreport.aspx.cs
File metadata and controls
45 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
using System.IO;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Reporting;
using CrystalDecisions.Shared;
public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString);
ReportDocument rdoc = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
//if (System.Web.HttpContext.Current.Session["Seller"] as string == null)
//{
//Response.Redirect("Login.aspx");
//}
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("salesselect", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable ds = new DataTable();
da.Fill(ds);
rdoc.Load(Server.MapPath("Sales1.rpt"));
rdoc.SetDataSource(ds);
rdoc.SetParameterValue("Dateparameter", TextBox1.Text);
CrystalReportViewer1.ReportSource = rdoc;
CrystalReportViewer1.DataBind();
con.Close();
}
}