Home > OS >  Content Dialog does not display after database insert query - UWP App
Content Dialog does not display after database insert query - UWP App

Time:04-21

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();

}

CodePudding user response:

Try to define String selItem as property like this String selItem{set;get;}=TaskCombo.SelectedValue.ToString();

CodePudding user response:

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.

  • Related