'Content Dialog does not display after database insert query - UWP App
I cannot get a UWP content dialog to display after executing a database insert query. Below is the code I have written. The Content dialog displays as it should when the insert query code is commented out. Am I missing something? Any help will be appreciated. Thanks
private async void Admin_Button_Click(object sender, RoutedEventArgs e)
{
String selItem = TaskCombo.SelectedValue.ToString();
dbDetail.AddAdminData(selItem, SettingTxt.Text);
Windows.UI.Xaml.Controls.ContentDialog infoDialog = new Windows.UI.Xaml.Controls.ContentDialog()
{
Title = "Alert",
Content = "Records entered successfully",
CloseButtonText = "OK"
};
Windows.UI.Xaml.Controls.ContentDialogResult result = await infoDialog.ShowAsync();
}
Solution 1:[1]
The problem was an open data reader associated with the connection that was open and needed to be closed first. The db query was executing successfully, however the content dialogue could not be display because of the open data reader.
Solution 2:[2]
Try to define String selItem as property like this String selItem{set;get;}=TaskCombo.SelectedValue.ToString();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tovs |
| Solution 2 | Ahmed Laoun |
