The method I used to insert a file into SQL Server was using an image
field and inserting the file like a normal parameter. The code I have is
in c# but a translation to VB.net should be trivial.
BinaryReader br = null;
byte [] buffer = null;
SqlCommand cmd = new SqlCommand("InsertFileStoredProc", myConn);
cmd.CommandType = CommandType.StoredProcedure;
InsertFileStoredProc would look something like this:
CREATE PROCEDURE dbo.InsertFileStoredProc
@AttachmentFile image
AS
INSERT INTO
AttachmentFiles ( AttachmentFile)
VALUES
(@Attachment)
RETURN
There is another method you can use that splits up the file into smaller
parts but I found that it was much slower and seeing as I cannot find the
links I'll let someone else (who know's it better) describe it.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.