0

I have a SQL Server table whose Rawcontent is of type varbinary FileStream

TABLE [dbo].[DocTable]
(
    VersionId [uniqueidentifier] NOT NULL,
    RawContent [varbinary](max) FILESTREAM  NULL,

Now when I am trying to get the fileStream data using :

foreach (DataRow dtr in dataTable.Rows)
{
    docStream = (byte[])dtr["RawContent"];
}

Getting an exception, can not convert from System.String to System.Byte.

Why I am getting a string back while the content is saved as FileStream on SQL Server?

1 Answer 1

1

if you have docstream declared as a byte array, you need to use a FileStream object first, and then convert that into a byte array

https://msdn.microsoft.com/en-us/library/vstudio/cc716724%28v=vs.100%29.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.