public partial class payment_detail : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["order"].ConnectionString); Decimal a; Decimal b; Decimal c; protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { //SqlDataAdapter da=new SqlDataAdapter("select * from TRANSACTIONTBL where NAME='"+DropDownList1.SelectedItem.Text+"' and BILLNO='"+TextBox1.Text+"'",con); SqlDataAdapter da = new SqlDataAdapter("select * from TRANSACTIONTBL where NAME='" + DropDownList1.SelectedItem.Text + "'", con); con.Open(); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); ////////////// con.Open(); // SqlCommand cmd = new SqlCommand("select * from TRANSACTIONTBL where NAME='" + DropDownList1.SelectedItem.Text + "' and BILLNO='" + TextBox1.Text + "'", con); SqlCommand cmd = new SqlCommand("select * from TRANSACTIONTBL where NAME='" + DropDownList1.SelectedItem.Text + "'", con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { a += Convert.ToDecimal(dr["DEBIT"].ToString()); b += Convert.ToDecimal(dr["CREDIT"].ToString()); } c = b - a; Label1.Text = a.ToString(); Label2.Text = b.ToString(); Label3.Text = c.ToString(); Label4.Visible = true; Label5.Visible = true; Label6.Visible = true; } } }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; SqlDataAdapter da = new SqlDataAdapter("select * from TRANSACTIONTBL where NAME='" + DropDownList1.SelectedItem.Text + "'", con); con.Open(); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); con.Close(); }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)