Inside the loop, just write the code to attach like below...
While dReader.Read()
fileName = dReader("DocName").ToString()
Dim documentBinary As Byte() = DirectCast(dReader("DocData"), Byte())
Dim fStream As New FileStream(Server.MapPath("~\Docs") & "\" & fileName, FileMode.Create)
fStream.Write(documentBinary, 0, documentBinary.Length)
fStream.Close()
fStream.Dispose()
If !String.IsNullOrEmpty(fileName) Then
mail.Attachments.Add(New Attachment("~Docs\" & fileName))
End While
So,
- Here you first check whether FileName is not null or blank.
- Written the code to attach the file in the loop. So, all the files will be attached one by one.