コード例 #1
0
        // Load dataset to datagridview
        public void LoadDataMaintainance()
        {
            // Fetch dataset
            DataSet maintainanceDS = DBGetData.GetMaintainanceDGVActive();

            if (maintainanceDS != null)
            {
                // No tables fetched
                if (maintainanceDS.Tables.Count == 0)
                {
                    new StatusMessage("No datatable found, contact administrator.");
                    return;
                }
                // No rows fetched
                else if (maintainanceDS.Tables[0].Rows.Count == 0)
                {
                    new StatusMessage("No datarows found in maintainance.");
                    return;
                }
                // Clear labelStatus for previous messages
                else
                {
                    new StatusMessage("");
                }

                // Set the dataset as source for datagridview and make sure its displayed
                dataGridViewMaintainance.DataSource = maintainanceDS;
                dataGridViewMaintainance.DataMember = "Get_Maintainance_Active";
                LoadDataGridViewMaintainance();
            }
        }