I'm trying to insert multiple documents at once. Database used is SQL 2008 My table has Image column type.
Now I am forming a datatable in c#, which has around 8-10 columns. One of the column is Byte[] type, where the file content is being saved. I am passing this datatable to the service where SProc is invoked.
In SProc , there is only 1 inout param, i.e. table type SessionDetails. Here the other columns are mapped according to the columns of datatable. The filecontent is being saved in FileContent column, which is of type Varbinary(max).
INSERT works correctly, but when I am trying to read the stored data, it is not able to open the uploaded doc/image/pdf .
I'm not sure where the issue is. In SP at no place I am using cast/convert for this variable At c# or database level :(
CREATE TYPE [dbo].[SessionDetails] AS TABLE(
[PID] [varchar](50) NULL,
[PString] [varchar](max) NULL,
[Objecttype] [int] NULL,
[FileName] [varchar](500) NULL,
[FileContent] varbinary(max) ,
[FileType] [varchar](50) NULL,
[ID] [int] NULL
)
Table details
attachment table -
Column name :iFile
Columntype: image