How to pass byte[] from C# as string to SQL Server stored procedure and convert into varbinary(MAX)
问题 In this project, there is a class which wraps ADO.NET for common data access like ExecuteDataReader , ExecuteScalar , etc.. When using these methods to call a stored procedure, it allows you to pass a Dictionary<string, string> of parameters (string key, string value), which are then added to the SqlCommand object as SqlParameter . There is a case where we have to save a document in the database. The document is a byte[] and the corresponding column in the database is varbinary(MAX) . We've