web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can’t delete record SQ...
Power Apps
Answered

Can’t delete record SQL Server

(0) ShareShare
ReportReport
Posted on by 3
I’m new to PowerApps. As my first test I hooked up a simple SQL Server table with 8 fields and an int identity primary key. I used the start with a database option in PowerApps to do this. Everything looks good. I can insert and update records. The only problem is I cannot delete. I can press the trash can icon and I get no error message but nothing happens. Why wouldn’t this work out of the box?
Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @DB_Gal ,

    Could you please share a bit more about your issue?

    Do you generate an app based on your SQL Table data source?

     

    Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. I assume that you generated an app (including three generated screens) based on your SQL Table data source, please consider set the OnSelect property of the "Trash" icon to following:

    Remove('[dbo].[SQLTable]', BrowseGallery.Selected)

    or

    RemoveIf('[dbo].[SQLTable]', 'Primary Key Column' = BrowseGallery.Selected.'Primary Key Column')

    In addition, please also make sure that you do not define any constraints within your SQL Table to prevent from deleting records from it.

     

    If the issue still exists, please consider take a try with the following workaround:

    Add the following formula within the OnSelect property of the Gallery:

    ...;
    Set(CurrentItem, ThisItem) /* <-- Add this formula */

    Then modify above formula as below:

    RemoveIf('[dbo].[SQLTable]', 'Primary Key Column' = CurrentItem.'Primary Key Column')

    or

    Remove('[dbo].[SQLTable]', CurrentItem)

     

    Best regards,

  • seewo Profile Picture
    59 on at

    @v-xida-msft 

    How to delete the line item together?  I want to detete the item first.  in "AllowanceLine" table , "Document ID" and "Line No" is primary key. thanks.  
    In below formula, the first line show wrong message.

    Remove(AllowanceLine,'Document ID'= Gallery4.Selected.'Document ID'); 
    Remove(Allowance,Gallery4.Selected);
    Select(RefreshIcon);

    seewo_0-1668066590102.png

     

  • seewo Profile Picture
    59 on at

    Ok Now.

    Remove('Allowance Line Items',Filter('Allowance Line Items','Document ID'=Gallery4.Selected.'Document ID'));
    Remove(Allowance,Gallery4.Selected);
    Select(RefreshIcon);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 382 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 329

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard