Hi Guys,

I've got an import program that reads csv files and imports the data to a sql server database. After the import I call a send email procedure which takes some arguments including the two files and adds them as attachments to a mail message, then sends the email:

Code:
MailMessage.Attachments.Add(New Mail.Attachment(HeaderFile))
            MailMessage.Attachments.Add(New Mail.Attachment(DetailFile)
but i get the error saying file is being used by another process when trying to add the attachment in the above code. How to I get around this?