protected void Button8_Click(object sender, EventArgs e) { string cmd = "exec sp_MedicineWarehouse " + TextBox8.Text; string connectionString = ConfigurationManager.ConnectionStrings["conStr"].ToString(); SqlConnection con = new SqlConnection(connectionString); SqlDataAdapter da = new SqlDataAdapter(cmd, con); DataSet ds = new DataSet(); da.Fill(ds); try { con.Open(); } catch (Exception) { con.Close(); return; throw; } GridView8.DataSource = ds; GridView8.DataBind(); con.Close(); }
public void DataViewDemo() { DataSet1.CategoryDataTable Category = new DataSet1.CategoryDataTable(); CategoryTableAdapter catAdap = new CategoryTableAdapter(); catAdap.Fill(Category); DataSet1.ProductsDataTable Products = new DataSet1.ProductsDataTable(); ProductsTableAdapter prodAdap = new ProductsTableAdapter(); prodAdap.Fill(Products); var result = from item in Products select item; DataView view = result.AsDataView(); view.Sort = "ProductName desc"; view.RowFilter = "CategoryID = 65985"; GridView7.DataSource = view; GridView7.DataBind(); DataSet1.ProductsRow row = null; List <DataSet1.ProductsRow> myList = new List <DataSet1.ProductsRow>(); foreach (DataRowView item in view) { row = (DataSet1.ProductsRow)item.Row; myList.Add(row); } GridView8.DataSource = myList; GridView8.DataBind(); }
public void getgrid() { DateTime dt1 = new DateTime(); DateTime dt2 = new DateTime(); dt1 = DateTime.ParseExact(txt_FromDate.Text, "dd/MM/yyyy", null); dt2 = DateTime.ParseExact(txt_ToDate.Text, "dd/MM/yyyy", null); d1 = dt1.ToString("MM/dd/yyyy"); d2 = dt2.ToString("MM/dd/yyyy"); string get; con = dbaccess.GetConnection(); get = "SELECT AGENT_ID,AGENT_NAME,ACCOUNT_NO,IFSCCODE,NETAMOUNT,BANK_NAME FROM (sELECT AGENT_ID,AGENT_NAME,ACCOUNT_NO,IFSCCODE,NETAMOUNT,BANK_ID FROM BankPaymentllotment WHERE PLANT_CODE='" + pcode + "' AND BANKFILENAME='" + getid + "' AND billfrmdate='" + d1 + "' and billtodate='" + d2 + "') AS BANK LEFT JOIN (sELECT BANK_NAME,BANK_ID,IFSC_CODE FROM BANK_MASTER WHERE PLANT_CODE='" + ddl_Plantname.SelectedItem.Value + "' GROUP BY BANK_NAME,BANK_ID,IFSC_CODE ) AS GG ON BANK.BANK_ID=GG.BANK_ID AND BANK. IFSCCODE =GG.IFSC_CODE"; SqlCommand cmd = new SqlCommand(get, con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { GridView8.DataSource = dt; GridView8.DataBind(); GridView8.FooterRow.Cells[3].Text = "TOTAL AMOUNT"; decimal milkkg = dt.AsEnumerable().Sum(row => row.Field <decimal>("NETAMOUNT")); GridView8.FooterRow.Cells[5].HorizontalAlign = HorizontalAlign.Right; GridView8.FooterRow.Cells[5].Text = milkkg.ToString("N2"); } else { GridView8.DataSource = null; GridView8.DataBind(); } }
protected void Button8_Click(object sender, EventArgs e) { var list = ws1.selectpopandavailablecar(); GridView8.DataSource = list; GridView8.DataBind(); }
protected void PurchaseHistory_Click(object sender, EventArgs e) { startDate = TextBox14.Text; endDate = TextBox15.Text + " 23:59:59:999"; customerID = TextBox16.Text; Label35.Text = string.Empty; SqlDataSource1.SelectParameters.Clear(); SqlDataSource1.SelectParameters.Add("startDate", startDate); SqlDataSource1.SelectParameters.Add("endDate", endDate); SqlDataSource1.SelectParameters.Add("customerID", customerID); SqlDataSource1.SelectCommand = "SELECT * from INVOICE WHERE date_time BETWEEN CONVERT(datetime, @startDate) AND CONVERT(datetime, @endDate) AND cust_ID = @customerID"; SqlDataSource1.CancelSelectOnNullParameter = false; if (startDate == "" || endDate == "" || customerID == "") { Label35.Text = "Please fill in all fields."; } else { GridView8.DataSource = SqlDataSource1; GridView8.DataBind(); if (GridView8.Rows.Count == 0) { Label35.Text = "No matching results found."; } } }
protected void GridView8_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = GridView8.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); // refer to the TextBox with the NewPageIndex value } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex } } else { newPageIndex = e.NewPageIndex; } GridView8.DataSource = dp.GetAuditSuggest(new Guid(PPID.Text)); GridView8.DataBind(); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= GridView8.PageCount ? GridView8.PageCount - 1 : newPageIndex; GridView8.PageIndex = newPageIndex; GridView8.DataBind(); }
private void ShowQ26_MUAC_LW() { MySqlConnection con = new MySqlConnection(constr); try { con.Open(); MySqlCommand cmd = new MySqlCommand("select * from muac_lw_crf3c where form_crf_3c_id='" + Convert.ToString(Session["form_crf_3c_id"]) + "' ", con); { MySqlDataAdapter sda = new MySqlDataAdapter(); { cmd.Connection = con; sda.SelectCommand = cmd; DataTable dt = new DataTable(); { sda.Fill(dt); GridView8.DataSource = dt; GridView8.DataBind(); con.Close(); } } } } catch (Exception ex) { Response.Write("<script type=\"text/javascript\">alert('" + ex.Message + "')</script>"); } finally { con.Close(); } }
protected void Button32_Click(object sender, EventArgs e) { GridView8.Visible = true; SqlDataSource9.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString()); SqlDataSource9.SelectCommand = "Select * From Daily_UsualWord where UW_Type='施工品質查核'"; GridView8.DataBind(); }
protected void Button30_Click(object sender, EventArgs e) { bool load_part1 = false; if (TextBox23.Text == "") { Response.Write("<script language=javascript>alert('資料尚未輸入!')</script>"); } else { GridView8.Visible = true; load_part1 = DAL.DailyMode.Data_Add2(Session["DatabaseName"].ToString(), "施工品質查核", TextBox23.Text); SqlDataSource9.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString()); SqlDataSource9.SelectCommand = "Select * From Daily_UsualWord where UW_Type='施工品質查核'"; GridView8.DataBind(); TextBox23.Text = ""; } if (load_part1) { Response.Write("<script language=javascript>alert('資料新增成功!')</script>"); } else { Response.Write("<script language=javascript>alert('資料新增失敗!')</script>"); } }
protected void Button29_Click(object sender, EventArgs e) { //-----------------ver aprobados---------------------- SqlDataSource9.SelectParameters["STATUS"].DefaultValue = "aprobado|"; SqlDataSource9.SelectParameters["RFC"].DefaultValue = " "; SqlDataSource9.DataBind(); GridView8.DataBind(); }
protected void btnEblaghInsert_Click(object sender, EventArgs e) { if (txtEblaghTitle.Text != "") { Value.InsertValues(lblEblaghID.Text, lblEblaghValue.Text, txtEblaghTitle.Text); } txtEblaghTitle.Text = ""; GridView8.DataBind(); }
protected void freshlanguage() { DataSet dst = new DataSet(); SqlConnection cnn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["dtcnn"].ConnectionString); SqlDataAdapter adpt = new SqlDataAdapter("select * from language", cnn); adpt.Fill(dst); GridView8.DataSource = dst.Tables[0]; GridView8.DataBind(); }
protected void GridView8_RowDeleting(object sender, GridViewDeleteEventArgs e) { int index = Convert.ToInt32(e.RowIndex); tbOEM = (DataTable)ViewState["Detalles5"]; tbOEM.Rows[index].Delete(); GridView8.DataSource = tbOEM; GridView8.DataBind(); Button4_ModalPopupExtender.Show(); }
protected void Button2_Click(object sender, EventArgs e) { SqlDataSource9.SelectParameters["STATUS"].DefaultValue = "aprobado|pendiente|rechazado"; SqlDataSource9.SelectParameters["RFC"].DefaultValue = TextBusc.Text; SqlDataSource9.DataBind(); GridView8.DataBind(); Panelbusc.Width = 20; Panelbusc.Height = 20; Panelbusc.Visible = false; }
protected void TextBox8_TextChanged(object sender, EventArgs e) { TN.DataBind(); GridView8.DataBind(); ShowDDL(); ColorTameio(); TextBox9.Focus(); GridView3.Columns[3].HeaderText = "Ποσό " + FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(Convert.ToDateTime(TextBox8.Text).ToString("yyyy-MM-dd")).ToString(); GridView4.Columns[0].HeaderText = FINANCIAL_MANAGEMENT.App_Code.xrisi.Fetch_Isot_Descr(Convert.ToDateTime(TextBox8.Text).ToString("yyyy-MM-dd")).ToString(); }
protected void odswiez() { string yyx = (string)Session["id_dzialu"]; id_dzialu.Text = (string)Session["txt_dzialu"]; string txt = string.Empty; // cl.deleteRowTable(); txt = txt + cl.clear_maim_db(); try { txt = txt + cl.generuj_dane_do_tabeli_wierszy(Date1.Date, Date2.Date, yyx, 1, tenPlik); txt = txt + cl.generuj_dane_do_tabeli_wierszy(Date1.Date, Date2.Date, yyx, 6, tenPlik); tabela_02(); tabela_03(); tabela_04(); tabela_05(); tabela_07(); /* * txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 2, Date1.Date, Date2.Date); * txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 3, Date1.Date, Date2.Date); * txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 4, Date1.Date, Date2.Date); * txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 5, Date1.Date, Date2.Date); * txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 6, Date1.Date, Date2.Date); * txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 7, Date1.Date, Date2.Date);*/ } catch { } // dopasowanie opisów makeLabels(); GridView1.DataBind(); GridView2.DataBind(); GridView3.DataBind(); GridView4.DataBind(); GridView6.DataBind(); GridView7.DataBind(); GridView8.DataBind(); try { Label11.Visible = cl.debug(int.Parse(yyx)); } catch { Label11.Visible = false; } Label11.Text = txt; Label3.Text = cl.nazwaSadu((string)Session["id_dzialu"]); }
protected void Button8_Click(object sender, EventArgs e) { String query = "SELECT Cf_name, Cl_name FROM Customer WHERE (Customer_id NOT IN (Select Customer_id FROM Order_table))"; SqlDataAdapter dataadapter = new SqlDataAdapter(query, conx); DataSet ds = new DataSet(); dataadapter.Fill(ds); GridView8.DataSource = ds; GridView8.DataBind(); }
// Updates the grid veiw after adding the new data protected void UpdateTablesData() { GridView1.DataBind(); GridView2.DataBind(); GridView3.DataBind(); GridView4.DataBind(); GridView5.DataBind(); GridView6.DataBind(); GridView7.DataBind(); GridView8.DataBind(); }
//reset all protected void Button5_Click(object sender, EventArgs e) { Label18.Text = ""; Label17.Text = ""; TextBox4.Text = ""; GridView8.DataSource = null; GridView8.DataBind(); GridView7.DataSource = null; GridView7.DataBind(); GridView3.DataSource = null; GridView3.DataBind(); }
protected void odswiez() { string yyx = (string)Session["id_dzialu"]; id_dzialu.Text = (string)Session["txt_dzialu"]; string txt = string.Empty; // txt = "File name: <b>oksp.aspx</b></br>"; txt = txt + "id wydzialu=" + yyx + "</br>"; cl.deleteRowTable(); txt = txt + cl.clear_maim_db(); try { txt = txt + cl.generuj_dane_do_tabeli_wierszy(Date1.Date, Date2.Date, yyx, 1, tenPlik); txt = txt + cl.generuj_dane_do_tabeli_wierszy(Date1.Date, Date2.Date, yyx, 7, tenPlik); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 2, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 3, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 4, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 5, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 6, Date1.Date, Date2.Date); txt = txt + cl.generuj_dane_do_tabeli_(int.Parse((string)Session["id_dzialu"]), 8, Date1.Date, Date2.Date); //txt = txt + cl.uzupelnij_statusy(); } catch { } // dopasowanie opisów makeLabels(); GridView1.DataBind(); GridView2.DataBind(); GridView3.DataBind(); GridView4.DataBind(); GridView6.DataBind(); GridView7.DataBind(); GridView8.DataBind(); try { Label11.Visible = cl.debug(int.Parse(yyx)); } catch { Label11.Visible = false; } Label11.Text = txt; Label3.Text = cl.nazwaSadu((string)Session["id_dzialu"]); }
protected void Page_Load(object sender, EventArgs e) { TextBox2.Visible = false; TextBox3.Visible = false; TextBox4.Visible = false; TextBox5.Visible = false; TextBox6.Visible = false; TextBox7.Visible = false; TextBox8.Visible = false; TextBox10.Visible = false; Label7.Visible = false; DataTable dt = new DataTable(); String mycon = "Data Source=DESKTOP-1S4EG4M; Initial Catalog=online_food_cart; Integrated Security=True"; String myquery = "select * from CartDetail Where Email ='" + Session["UID"].ToString() + "'"; SqlConnection con = new SqlConnection(mycon); SqlCommand cmd = new SqlCommand(); cmd.CommandText = myquery; cmd.Connection = con; SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataSet ds = new DataSet(); da.Fill(dt); GridView8.DataSource = dt; GridView8.DataBind(); con.Close(); GridView8.FooterRow.Cells[1].Text = "Total Amount"; GridView8.FooterRow.Cells[2].Text = dt.Compute("Sum(price)", "").ToString(); TextBox10.Text = GridView8.FooterRow.Cells[2].Text; Label9.Text = "Amount to be paid =" + TextBox10.Text; conn.Open(); cmd = new SqlCommand("Select ADRS,MobileNo from CustomerDetails where Email ='" + Session["UID"].ToString() + "' ", conn); dr = cmd.ExecuteReader(); dr.Read(); if (dr.HasRows == true) { TextBox8.Text = dr["ADRS"].ToString(); Label2.Text = TextBox8.Text; Label3.Text = dr["MobileNo"].ToString(); } dr.Close(); conn.Close(); }
void uyegetir() { baglanti.ConnectionString = "provider=Microsoft.Jet.OleDb.4.0; Data Source=" + Server.MapPath("Srezervasyon.mdb"); baglanti.Open(); OleDbDataAdapter adap29 = new OleDbDataAdapter("Select *from uyeler ", baglanti); DataSet dc29 = new DataSet(); adap29.Fill(dc29); GridView8.DataSource = dc29; GridView8.DataBind(); baglanti.Close(); }
protected void Button8_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand("select ans from qa where ques='" + TextBox4.Text + "'", con); SqlDataAdapter ad = new SqlDataAdapter(cmd); cmd.Parameters.AddWithValue("@ques", TextBox4.Text); con.Open(); SqlDataReader rd = cmd.ExecuteReader(); GridView8.DataSource = rd; GridView8.DataBind(); con.Close(); }
public void BindData8() { DataSet ds8 = new DataSet(); cmd8 = new OracleCommand(); cmd8.CommandText = "Select book_name as book_name, book_auther as auther, book_edition_num as edition_number, book_date_of_publish as coppyRight, borrowed as borrowed, book_statuse as status from books where ctg_id='617'"; cmd8.Connection = con; da = new OracleDataAdapter(cmd8); da.Fill(ds8); con.Open(); cmd8.ExecuteNonQuery(); GridView8.DataSource = ds8; GridView8.DataBind(); con.Close(); }
protected void Button31_Click(object sender, EventArgs e) { if (TextBox24.Text == "") { Response.Write("<script language=javascript>alert('資料尚未輸入!')</script>"); } else { GridView8.Visible = true; SqlDataSource9.ConnectionString = Utility.DBconnection.connect_string(Session["DatabaseName"].ToString()); SqlDataSource9.SelectCommand = "Select * From Daily_UsualWord where UW_Type='施工品質查核' and UW_Content Like '%" + TextBox24.Text + "%'"; GridView8.DataBind(); TextBox24.Text = ""; } }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString = @"data source=.\ sqlexpress; attachdbfilename=|datadirectory|\Database.mdf;user instance=true; integrated security= true"; con.Open(); SqlDataAdapter ad1 = new SqlDataAdapter("select * from productbooks", con); SqlDataAdapter ad2 = new SqlDataAdapter("select * from productbooks1", con); SqlDataAdapter ad3 = new SqlDataAdapter("select * from productlap", con); SqlDataAdapter ad4 = new SqlDataAdapter("select * from productcam", con); SqlDataAdapter ad5 = new SqlDataAdapter("select * from productmobile", con); SqlDataAdapter ad6 = new SqlDataAdapter("select * from productfashion", con); SqlDataAdapter ad7 = new SqlDataAdapter("select * from productfashion1", con); SqlDataAdapter ad8 = new SqlDataAdapter("select * from productfashion3", con); DataSet dt1 = new DataSet(); DataSet dt2 = new DataSet(); DataSet dt3 = new DataSet(); DataSet dt4 = new DataSet(); DataSet dt5 = new DataSet(); DataSet dt6 = new DataSet(); DataSet dt7 = new DataSet(); DataSet dt8 = new DataSet(); ad1.Fill(dt1); ad2.Fill(dt2); ad3.Fill(dt3); ad4.Fill(dt4); ad5.Fill(dt5); ad6.Fill(dt6); ad7.Fill(dt7); ad8.Fill(dt8); GridView1.DataSource = dt1; GridView1.DataBind(); GridView2.DataSource = dt2; GridView2.DataBind(); GridView3.DataSource = dt3; GridView3.DataBind(); GridView4.DataSource = dt4; GridView4.DataBind(); GridView5.DataSource = dt5; GridView5.DataBind(); GridView6.DataSource = dt6; GridView6.DataBind(); GridView7.DataSource = dt7; GridView7.DataBind(); GridView8.DataSource = dt8; GridView8.DataBind(); }
protected void drp_Course_SelectedIndexChanged(object sender, EventArgs e) { if (drp_Course.SelectedItem.Text == "B.tech") { SqlConnection con = new SqlConnection("server=SACHIN;uid=sa;pwd=sachin1996;database=college"); SqlDataAdapter dap = new SqlDataAdapter("select * from college_info where c_btech='YES'", "server=SACHIN;uid=sa;pwd=sachin1996;database=college"); DataSet ds = new DataSet(); dap.Fill(ds); GridView8.DataSource = ds.Tables[0]; GridView8.DataBind(); } else if (drp_Course.SelectedItem.Text == "M.tech") { SqlConnection con = new SqlConnection("server=SACHIN;uid=sa;pwd=sachin1996;database=college"); SqlDataAdapter dap = new SqlDataAdapter("select * from college_info where c_mtech='YES'", "server=SACHIN;uid=sa;pwd=sachin1996;database=college"); DataSet ds = new DataSet(); dap.Fill(ds); GridView8.DataSource = ds.Tables[0]; GridView8.DataBind(); } else if (drp_Course.SelectedItem.Text == "B.A") { SqlConnection con = new SqlConnection("server=SACHIN;uid=sa;pwd=sachin1996;database=college"); SqlDataAdapter dap = new SqlDataAdapter("select * from college_info where c_ba='YES'", "server=SACHIN;uid=sa;pwd=sachin1996;database=college"); DataSet ds = new DataSet(); dap.Fill(ds); GridView8.DataSource = ds.Tables[0]; GridView8.DataBind(); } else if (drp_Course.SelectedItem.Text == "M.A") { SqlConnection con = new SqlConnection("server=SACHIN;uid=sa;pwd=sachin1996;database=college"); SqlDataAdapter dap = new SqlDataAdapter("select * from college_info where c_ma='YES'", "server=SACHIN;uid=sa;pwd=sachin1996;database=college"); DataSet ds = new DataSet(); dap.Fill(ds); GridView8.DataSource = ds.Tables[0]; GridView8.DataBind(); } else { SqlConnection con = new SqlConnection("server=SACHIN;uid=sa;pwd=sachin1996;database=college"); SqlDataAdapter dap = new SqlDataAdapter("select * from college_info where c_mbbs='YES'", "server=SACHIN;uid=sa;pwd=sachin1996;database=college"); DataSet ds = new DataSet(); dap.Fill(ds); GridView8.DataSource = ds.Tables[0]; GridView8.DataBind(); } }
protected void GridView8_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "del") { GridView8.SelectedIndex = Convert.ToInt32(e.CommandArgument); DataTable dt = new DataTable(); dt = (DataTable)ViewState["table"]; dt.Rows[Convert.ToInt32(GridView8.SelectedIndex.ToString())].Delete(); dt.AcceptChanges(); GridView8.DataSource = dt; GridView8.DataBind(); ViewState["table"] = dt; //ModalPopupExtender4.Show(); // Label26.Text = "Record deleted successfully."; } }
public void getgrid() { DateTime dt1 = new DateTime(); DateTime dt2 = new DateTime(); DBManager vdm = new DBManager(); string branch = ddlbranch.SelectedItem.Value; string month = ddlmonth.SelectedItem.Value; string year = ddlyear.SelectedItem.Value; string get; string fileid = ""; SqlCommand CMD1 = new SqlCommand("SELECT sno FROM bankformatmaster WHERE filename=@filename"); CMD1.Parameters.Add("@filename", getid); DataTable dtFILENAME = vdm.SelectQuery(CMD1).Tables[0]; if (dtFILENAME.Rows.Count > 0) { fileid = dtFILENAME.Rows[0]["sno"].ToString(); } SqlCommand cmd = new SqlCommand("SELECT subbankformatmaster.empid, subbankformatmaster.empname, subbankformatmaster.bankaccountno, subbankformatmaster.ifsccode, CONVERT(int, subbankformatmaster.netpay) AS netpay, bankmaster.bankname FROM subbankformatmaster INNER JOIN bankmaster ON subbankformatmaster.bankid = bankmaster.sno WHERE subbankformatmaster.branchid=@branchid AND month=@month AND year=@year AND refno=@refno"); cmd.Parameters.Add("@branchid", branch); cmd.Parameters.Add("@month", month); cmd.Parameters.Add("@year", year); cmd.Parameters.Add("@refno", fileid); DataTable dt = vdm.SelectQuery(cmd).Tables[0]; if (dt.Rows.Count > 0) { GridView8.DataSource = dt; GridView8.DataBind(); GridView8.FooterRow.Cells[4].Text = "TOTAL AMOUNT"; decimal milkkg = dt.AsEnumerable().Sum(row => row.Field <int>("netpay")); GridView8.FooterRow.Cells[5].HorizontalAlign = HorizontalAlign.Right; GridView8.FooterRow.Cells[5].Text = milkkg.ToString("N2"); } else { GridView8.DataSource = null; GridView8.DataBind(); GridView8.Visible = false; Button2.Visible = false; } }
protected void Button22_Click(object sender, EventArgs e) { GridView8.DataSource = null; GridView8.DataBind(); MySqlConnection con = new MySqlConnection("server=localhost;user id=root;persistsecurityinfo=True;database=test_db;password=somoslossuper11"); con.Open(); MySqlCommand cmd = new MySqlCommand("call Herramienta_x_Equipo_x_Proyecto()", con); MySqlDataAdapter adp = new MySqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); GridView8.DataSource = ds; GridView8.DataBind(); cmd.Dispose(); con.Close(); }