I need the stored procedure to return the array of bytes instead of a string.
The error I am getting is: Unable to cast object of type System.Byte[] to type System.String.
The stored procedure:
The error I am getting is: Unable to cast object of type System.Byte[] to type System.String.
Code:
ISingleResult<spVTGetAttachmentSelectResult> Result = ava.GetAttachment(AttachmentID);
foreach (spVTGetAttachmentSelectResult Pdf in Result)
{
System.Text.UTF8Encoding Str = new System.Text.UTF8Encoding();
string FileName = Pdf.Attachment;
string Extension = (Pdf.FileExtension).ToString();
byte[] DocBuffer = Str.GetBytes(FileName);
}
Code:
ALTER PROCEDURE [dbo].[spVTGetAttachmentSelect] (@AttachmentID int)
AS
BEGIN
SELECT VehicleAttachments.Attachment, VehicleAttachments.FileExtension
FROM VehicleAttachments
WHERE (VehicleAttachments.AttachmentID = @AttachmentID)
END
Comment