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 / Power App, Power BI, S...
Power Apps
Answered

Power App, Power BI, SQL Server integration (read, write functionality)

(1) ShareShare
ReportReport
Posted on by 71

Good day,

 

Currently I am working on a small project, which should allow users to add comments to Power BI table.

To achieve this, I'm using Power App and PowerBIIntegration and saving those comments on SharePoint for further analysis but the business required, that the comments should be send to provided SQL Server.

 

I was able to connect to it with Power App, I can retrieve data from it but I cannot save the data there. I'm talking about saving 1 - 100 rows per session so it's not huge amount, therefore I suggested we won't use Power Automate to run a SQL query and simply update the db from PA directly.

 

The issue is, I've spent several hours trying to find a way how to add new rows into the db, with no luck.

I though that the most simple command would be:

Patch(
 PA_server,
 Defaults(PA_server),
 {
 Comment: TextInput5,
 Updated: Now(),
 Updated_by: User().Email
 }
);
Notify("Success",NotificationType.Success,5000);

But it gives me an error:

Network error when using Patch function: The specified record was not found.

Columns Comment, Updated and Updated_by are exactly what I have in the db, so I got lost.

 

I would appreciate if you could let me know what I'm doing wrong or maybe suggest different approach I can study and implement.

 

Best regards. 

Categories:
I have the same question (0)
  • Pro_User_365 Profile Picture
    546 on at

    Hi @Copycat ,

    It seems like you're facing a challenge with adding new rows to a SQL Server database from Power Apps. The Patch function is generally the right approach, but the error suggests a mismatch or an issue with the connection. Here are a few steps to check:

    1. Connection Verification: Ensure the Power App is correctly connected to the SQL Server database. Double-check your connection settings.

    2. Table Schema: Verify that the column names in your Patch command exactly match those in your SQL Server table. Even a small typo can cause issues.

    3. Permissions: Make sure the account used for the connection has the necessary permissions to insert data into the SQL Server database.

    4. Data Types: Ensure that the data types of the values you're sending from Power Apps match the data types expected by the SQL Server table.

    If these aspects are all correct, try a simpler Patch command first with minimal fields to see if that works. If it does, gradually add other fields.

    Sometimes, it’s also a good idea to use a different approach like Power Automate if direct methods face persistent issues.

    Hope this helps you move forward with your project!

    Note: After receiving the answer, if you find it helpful, please consider accepting it. 😊 Regards, Ali Shahzad

  • Verified answer
    Copycat Profile Picture
    71 on at

    Found the issue.

    Code was missing .text.

     

    So it should be:

    Patch(
     PA_server,
     Defaults(PA_server),
     {
     Comment: TextInput5.Text,
     Updated: Now(),
     Updated_by: User().Email
     }
    );
    Notify("Success",NotificationType.Success,5000);

     

    For Now() function I noticed my SQL table column was date only, so I switched it to datetime and it was fixed.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 644

#3
11manish Profile Picture

11manish 626

Last 30 days Overall leaderboard