I found the issue - the dataset didn't have a primary key!
Unable to write to Azure SQL Database from PowerApps
I have a relatively simple PowerApp that writes a value to an Azure SQL Database along with the timestamp when it was written and some values from the Power BI Integration fields.
I previously had it writing to a sharepoint list and it ran fine. However I've not managed to get the app writing to the database. In the patch function, the data source is underlined but there isn't an error in the rest of the code. When hovering over the source, I get a tooltip saying that 'The function Patch has some invalid arguments'
I'm able to write to the table using the Query Editor, and whilst the PowerApp is able to read the dataset fine in a gallery which I tested, however is unable to write. Please help!
2 answers
Sort by: Most helpful
-
-
GeethaThatipatri-MSFT 28,932 Reputation points Microsoft Employee
2024-06-20T17:41:14.2466667+00:00 @BadatI Great job identifying the issue! Thank you and very much appreciated for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue: You are facing an issue with writing data to an Azure SQL Database from PowerApps. The data source is underlined in the patch function, and you receive a tooltip saying that 'The function Patch has some invalid arguments'. you are able to read the dataset fine in a gallery but is unable to write to the table.
Solution: As you mentoned you have resolved the issue as the dataset didn't have a primary key! Having a primary key is crucial for the integrity of your dataset and to ensure that each record is unique, which is essential for operations like
Patch
to work correctly in PowerApps. Now that you've added a primary key, your app should be able to write to the Azure SQL Database as expected.If you have any other questions or are still running into more issues, please let me know.
Please remember to "Accept Answer" , so that others in the community facing similar issues can easily find the solution.
Regards
Geetha