Hi, I want to insert to database 3MB file.
faxMessage.FaxFile is a byte[] - 3MB file.
I use stored procedures, like below:
using (SqlCommand sc = new SqlCommand("Myproc", sqlConnection))
{
sc.CommandType = CommandType.StoredProcedure;
sc.CommandTimeout = 100;
sc.Transaction = transaction;
sc.Parameters.Add(new SqlParameter("@inFaxFile", SqlDbType.VarBinary, faxMessage.FaxFile.Length));
sc.Parameters["@inFaxFile"].Value = faxMessage.FaxFile;
using (sc.ExecuteReader())
{
}
}
Should I change sth in SQL Server configuration ? It is simple VARCHAR(MAX) column.
I know, that maybe this is rookie question, but pleas help me.
UPDATE:
Or maybe I need to change sth in stored procedure? Here is the code:
BEGIN TRANSACTION
BEGIN
BEGIN TRY
INSERT INTO [mgdb].[dbo].[Message]
([NumberFrom]
,[FaxFile])
VALUES
(@inNumberFrom
,@inFaxFile)
SET @outId = SCOPE_IDENTITY()
COMMIT
END TRY
BEGIN CATCH
SET @outId = -1
ROLLBACK
END CATCH
END