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:
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!
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))
cmd.Connection.Open()
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
reader.Close()
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=" + Filename)
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.BinaryWrite(ByteData)
Response.Flush()
Response.[End]()
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!