private void SelectMaintenance() { try { using (var sqlConnection = new SqlConnection(connectionString)) { sqlConnection.OpenAsync(); var dynamicParameters = new DynamicParameters(); dynamicParameters.Add("work_order", TextBoxWorkOrder.Text, DbType.String, ParameterDirection.Input); dynamicParameters.Add("machine", TextBoxMachine.Text, DbType.String, ParameterDirection.Input); dynamicParameters.Add("employee", TextBoxEmployee.Text, DbType.String, ParameterDirection.Input); dynamicParameters.Add("num_rows", 20, DbType.Int32, ParameterDirection.Input); IEnumerable <ScannerData> result = sqlConnection.Query <ScannerData>( "sp_machine_maint_select", dynamicParameters, commandType: CommandType.StoredProcedure); GridViewMachineMaint.DataSource = result; GridViewMachineMaint.DataBind(); } } catch (Exception e) { SetErrorMessage("Error: " + e.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GridViewMachineMaint.DataSource = null; GridViewMachineMaint.DataBind(); GridViewMachineMaintParts.DataSource = null; GridViewMachineMaintParts.DataBind(); return; } ; }