ios - Save image taken from iPad/iPhone to sql server database base64 -
I'm having trouble saving SQL Server data from my iPad app, I think it's mostly with data types To start with the database, I have a SQL Server data type as my image field: The image I searched for .NET in an equivalent data type and I found this link: that the best option is a byte array: Byte []
In unit / class I am in .NET I'm doing yoga. Following: Public Classroom MyClass {public byte [image] {get; Set; }} And the parameter used to pass this data looks like this:
SqlParameter param_image = cmd.Parameters.Add ("IMAGE", SqlDbType.Image, item.Image. Length;) Param_image.Value = System.Convert.FromBase64String (item.Image); Param_image.Directing = Parameter Direction.Input; However, I'm getting an error from the parameter about trying to convert from string to a byte array. Has anyone done this?
two comments:
-
Item.Image byte [], And not expecting the string as Base64String (maybe this is your error?). Try:
param_image.Value = item.Image
-
You should use varbinary (max) instead of IMAG datatype: IMAGE Data Type Dislikes ( Supported) but will be removed in the future)
Comments
Post a Comment