-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTotal.aspx.cs
More file actions
36 lines (34 loc) · 991 Bytes
/
Copy pathTotal.aspx.cs
File metadata and controls
36 lines (34 loc) · 991 Bytes
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
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ConsumablesPortal
{
public partial class Total : 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 item ";
dt = new DataTable();
con.Open();
da = new SqlDataAdapter(query, this.con);
da.Fill(dt);
if(dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
}
}
}