[RESOLVED] I need help on attching files in VB2005
Hello evryone:
I need some help and i am hoping someone can help me;
I am working on a project and I would like to add an attachment option, where the user will be able to add any type of file (attachment) and be able to be save into an SQL2005 database
Can someone provime with some sample code?
Thanks you so much
Re: I need help on attching files in VB2005
This link talks about images, but it can really be any file type:
http://www.vbforums.com/showthread.php?t=469562
Re: I need help on attching files in VB2005
In that example of mine the Image object is saved to a MemoryStream and then the contents of that Stream is saved to the database. If you're saving a file then you'd create a FileStream and save the contents of that Stream to the database.
Just note that saving files in databases is a great way to make them grow very quickly and thus become less efficient. Storing files in the file system is preferable if it can be done.
Re: I need help on attching files in VB2005
Quote:
Originally Posted by jmcilhinney
Just note that saving files in databases is a great way to make them grow very quickly and thus become less efficient. Storing files in the file system is preferable if it can be done.
Just to add to JMC's point, if for some reason a user accidently deletes the attachment, restoring that from a backup can be a pain if it stored in the database, because you have to restore a single row.