MarcoART_
How to insert an image from a MediaPicker into my database in C# (MAUI)
Hello! 🙂 I'm new to MAUI and I'm facing challenges trying to insert an image from a MediaPicker into my database.
What I do is obtain either my byte array using these lines:
or obtain the data in a base64 string value using this line:
The problem is, once I obtain these values that I need to insert into my database, and I execute the insert query, I'm getting this error:
Microsoft.Data.SqlClient.SqlException: 'A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - Success)'
This only happens if i'm including the image in the query, if I eliminate it, the other data can be inserted perfectly without showing me any error.
This is my query:
And this is my connection string:
Thank You!
20 replies