Certainly! Saving an image to SQL Server directly from a Power Apps Canvas app without using Power Automate involves a few steps. Here's a concise guide to help you achieve this:
VARBINARY(MAX)
to store the image data.
CREATE TABLE Images (
Id INT PRIMARY KEY IDENTITY(1,1),
ImageData VARBINARY(MAX)
);
Capture the Image: Use the Camera control to capture the image and store it in a variable.
Set(capturedImage, Camera1.Photo)
Convert Image to Binary: Power Apps does not directly support binary conversion, so you need to use a workaround by converting the image to a data URI and then to binary.
Set(imageDataUri, JSON(capturedImage, JSONFormat.IncludeBinaryData))
Save Image to SQL Server: Use the Patch
function to save the image data to SQL Server.
Patch(
'[dbo].[Images]',
Defaults('[dbo].[Images]'),
{
ImageData: Mid(imageDataUri, Find(",", imageDataUri) + 1)
}
)
By following these steps, you can save images directly to SQL Server from a Power Apps Canvas app without needing Power Automate. If you encounter any issues or need further customization, feel free to ask!
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional