New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to have binary data in your POCO? #24
Comments
@gustavjon I may assume that problem in the "byte?[]" type - it is not detected as known type for varbinary sql type. Could you try "byte[]" and let me know about the results? |
@gustavjon is your question still actual? Could you provide any update? |
I tried byte[] but I had the same problem. I decided to write a stored procedure instead but I actually ran into the same error doing that when I tried to insert null so in the end I had to make the column default to null rather then inserting a null value. |
@gustavjon I've performed some tests with SQL server and "varbinary" column type and found the following:
Thank you for reporting about the issue! I'll try to provide bugfix release soon. |
…pe when DbParameter should be used (command reused for several inserts/updates) #24
Shipped in 1.0.1 |
I could use some help inserting binary data.
The database I'm using is sql server 2014. The column i'm trying to insert som bytes into looks like this:
[BinaryData]varbinary NULL,
In my code the property looks like this:
public byte?[] BinaryData { get; set; }
I'm simply inserting this using
dbAdapter.Insert("MyTable", entity);
but when It's inserted I get this exception "Implicit conversion from data type nvarchar to varbinary(max) is not allowed".
If I comment out the binary property everything works just fine.
I've tried adding the Column annotation like this on the property in my code but that didnt help.
[Column(“BinaryData", TypeName="varbinary")]
Some help would be much appreciated.
The text was updated successfully, but these errors were encountered: