-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTables.aspx.cs
More file actions
96 lines (76 loc) · 2.8 KB
/
Copy pathTables.aspx.cs
File metadata and controls
96 lines (76 loc) · 2.8 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
using ClosedXML.Excel;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Project_Final
{
public partial class Tables : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString);
DataTable dt;
SqlDataAdapter da;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
string query = "SELECT * from SystemData INNER JOIN UserData ON SystemData.PO_NO = UserData.PO_NO ";
dt = new DataTable();
con.Open();
da = new SqlDataAdapter( query, this.con);
da.Fill(dt);
if (dt.Rows.Count > 0)
{
ViewState["EICIODATA"] = dt;
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
}
/*
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/";
Response.AddHeader("content-disposition","attachment; filename=UserInfo.xls");
Response.Charset = "";
StringWriter sw = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(sw);
GridView1.RenderControl(writer);
Response.Output.Write(sw.ToString());
Response.Close();
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
}
*/
/*
protected void Button1_Click(object sender, EventArgs e)
{
DataTable dt = (DataTable)ViewState["EICIODATA"];
using (XLWorkbook wb = new XLWorkbook())
{
wb.Worksheets.Add(dt, "Testing");
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", "attachment;filename=Testing.xlsx");
using (MemoryStream ms = new MemoryStream())
{
wb.SaveAs(ms);
ms.WriteTo(Response.OutputStream);
Response.Flush();
Response.End();
}
}
}*/
}
}