November 30, 2011 at 6:32 am
hi all,
i have a field of image data type in my table in sqlserver.
i am using enterprise library5.0.
i have Byte[] imgByte variable.
how i can pass this Byte[] in parameter
this is not working
db.AddInParameter(dbCommand, "@img", DbType.Binary, imgByte);
what type i should declare in my store procedure?
what i should do with this "DbType.Binary"?
November 30, 2011 at 7:25 am
You should change your datatype in your table to varbinary(max). The image datatype is deprecated. Then you just use varbinary(max) as your parameter.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 1, 2011 at 10:32 am
In my enterprise library i do not have varbinary(max).Here is only binary...would u suggest anything?
December 1, 2011 at 10:37 am
I think you can just change your datatype in the database and leave your code as is. You are already referencing a binary type. I don't have any experience using the enterprise libraries but I am guessing that the type you declared "DbType.Binary" is intended to be used with the binary datatype. Make sure you are doing this in a test location.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
December 1, 2011 at 11:08 am
Worked For me.i saved image.Now please do clear me about image and varbinary max data types.....as both worked for me.wich one ll be better to use?
December 1, 2011 at 12:02 pm
Glad that worked for you.
You want to use varbinary instead of image. The image datatype has been deprecated and will no longer be supported at some point in the future.
here are links to both from BOL:
Image - http://msdn.microsoft.com/en-us/library/ms187993.aspx (Note the description of what the image datatype is)
varbinary - http://msdn.microsoft.com/en-us/library/ms188362.aspx
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply