Results 1 to 2 of 2

Thread: File being used by another process error

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    File being used by another process error

    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?

  2. #2
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Re: File being used by another process error

    maybe the sql server is still using them or not closing them properly ?
    * Rate It If you Like it

    __________________________________________________________________________________________

    "Programming is like sex: one mistake and you’re providing support for a lifetime."

    Get last SQL insert ID

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width