private void btn_SearchIfo_Click(object sender, EventArgs e) { try { Dictionary <string, object> param = new Dictionary <string, object>(); param.Add("p_FromDate", dte_FromDate.Text == "" ? "" : dte_FromDate.DateTime.ToString("dd/MM/yyyy")); //0 param.Add("p_ToDate", dte_ToDate.Text == "" ? "" : dte_ToDate.DateTime.ToString("dd/MM/yyyy")); //0 param.Add("UserName", slu_SearchUser.EditValue.ToString()); //2 param.Add("UserID", Form_Main.user.Username); //3 DataSet ds = new DataSet(); ds = SQLHelper.ExecuteDataSetUndefine("sp_Get_Commission_Of_Employees", param); DataTable dt = new DataTable(); if (ds != null && ds.Tables.Count == 2) { dt = ds.Tables[0]; } dgc_Main.DataSource = dt; dt = ds.Tables[1]; for (int i = 0; i < dt.Rows.Count; i++) { string colname = dt.Rows[i][0].ToString(); if (colname != null && colname != "") { dgv_Main.Columns[colname].Visible = true; } } dgv_Main.BestFitColumns(true); } catch (Exception ex) { API.API_ERRORLOG(new ERRORLOG(Form_Main.IPAddress, "Frm_CommissonOfElp", "btn_SearchIfo_Click()", ex.ToString())); } }