Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Multi File Retreival from SQL table

Multi File Retreival from SQL table

Multi File Retreival from SQL table

Afternoon, I'm hoping I am in the right forum, if not, could someone please advise.

I have an ASP.Net application, using VB to code. I am creating client invoices and saving the PDF version in a SQL table.
My users have an option to be able to Email the invoices to the respective client, and that, I believe I can acheive! I am retrieving the data using the following code:

CODE -->

Dim Filename As String = String.Empty
        Dim ByteData As Byte() = Nothing

        Dim cmd As New SqlCommand("Select * from InvoiceFiles where FileID = '" & DropDownList2.SelectedValue & "'", New SqlConnection(constr))

        Dim reader As SqlDataReader = cmd.ExecuteReader

        If reader.HasRows Then
            While reader.Read
                Filename = reader.Item("Name").ToString & ".pdf"
                ByteData = DirectCast(reader.Item("Data"), Byte())
            End While
        End If


        Response.Buffer = True
        Response.ContentType = "application/pdf"
        Response.AddHeader("content-disposition", "attachment;filename=" + Filename)
        Response.Charset = ""

        DropDownList2.Enabled = False 

This takes my file and drops it in the Download folder. The issue I have is that in some instances, the invoice needs to be accompanied by a further file, in this case a spreadsheet. I have proved that I can retrieve the spreadsheet if I do it in isolation, however, I need to retreive both the files at the same time. I will then attach both files to the Email, send it and then remove both files from the Download folder.

For further clarification, this is intended as an in-house, web-based product and will only be published internally.

Is what I'm trying to acheive possible? Am I going down the wrong route?

Many thanks from an ASP.NET novice!

RE: Multi File Retreival from SQL table

What cases do you need to attach a spreadsheet. Is it associated with the PDF in the table? What is your table(s) structure and relationships?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close