private void ProductSetup() { pageName.Text = "Entity Editor - Product Records"; string query = $"select id,name,description,unitPrice,stockCount,unitCost from products"; dataSource = DBAccessHelper.GetProductsReturnDataTable(query); if (dataSource == null) { dataSource = new DataTable() { Columns = { { "error" }, { "no values found" } } } } ; resultDg.ItemsSource = dataSource.AsDataView(); resultDg.Visibility = form.Visibility = formProductData.Visibility = deleteSelectedRecord.Visibility = addNewRecord.Visibility = saveFormChanges.Visibility = Visibility.Visible; }