Sqlserver image columns


#1

I am trying to upload word docs to an image column. I followed the
cookbook for how to upload files and it works on a MySQL db (upload
and download) on SQLServer however I get the following error
DBI::DatabaseError: Execute
OLE error code:80040E07 in Microsoft OLE DB Provider for SQL Server
Operand type clash: text is incompatible with image
HRESULT error code:0x80020009

Also I when I try to retrieve one (I put one in with java), all I get
is numbers. It doesn’t look it is being converted to binary.

Here is some my code
class Attachment < ActiveRecord::Base
def initialize (tmpfile)
super()
self.filename = tmpfile.original_filename
self.content_type = tmpfile.content_type
self.created = DateTime.now().strftime("%Y%m%d %I:%M")
self.file = tmpfile.read
end

Here is how I am rendering the documents
send_data attachment.file, :filename => attachment.filename, :type =>
attachment.content_type