public void FillGrid() { try { LODSHT = Request.QueryString["LODSHT"]; dt_ = new DataTable(); SqlCommand cmd = new SqlCommand("dbo.sp_loadsheet", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@dsrdat", LODSHT); SqlDataAdapter rdr = new SqlDataAdapter(cmd); rdr.Fill(dt_); //dt_ = DBConnection.GetQueryData(" select * from v_loadsheet where dsrdat ='" + LODSHT + "' and CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "'"); if (dt_.Rows.Count > 0) { //lblsalman.Text = dt_.Rows[0]["Purchase Rate"].ToString(); GVLoadSheet.DataSource = dt_; GVLoadSheet.DataBind(); } } catch (Exception ex) { throw ex; } }
public void FillGrid() { try { DSR = Request.QueryString["ID"]; CAL = Request.QueryString["CAL"]; EMPID = Request.QueryString["EMPID"]; dt_ = new DataTable(); if (CAL != null) { dt_ = DBConnection.GetQueryData(" select * from v_loadsheet where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "' and MSal_dat='" + CAL + "'"); //select * from v_dsr where v_dsr.MSal_dat='01/17/2019' and BranchId= '001' and CompanyId = 'COM_001' } else if (EMPID != "0") { dt_ = DBConnection.GetQueryData(" select * from v_loadsheet where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "' and username='******'"); //select * from v_dsr where v_dsr.MSal_dat='01/17/2019' and BranchId= '001' and CompanyId = 'COM_001' } else if (CAL != null && EMPID != "0") { dt_ = DBConnection.GetQueryData(" select * from v_loadsheet where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "' and MSal_dat='" + CAL + "' and username='******'"); } else { dt_ = DBConnection.GetQueryData(" select * from v_loadsheet where CompanyId = '" + Session["CompanyID"] + "' and BranchId= '" + Session["BranchID"] + "'");// and MSal_dat=replace(convert(NVARCHAR, getdate(), 106), ' ', '/')"); } //lbltotal.Text = GVLoadSheet.DataSource = dt_; GVLoadSheet.DataBind(); } catch (Exception ex) { throw ex; } }