excel file attachment

G

Guest

Hi,

i have problem in attaching excel file and store into sqldatabase.
have any ideas?

I'm totally new to this ability.

your help will be appreciated.
thank you.

Bset regards,
Gin Lye Khor
 
G

Guest

Hi All,
thanks for ur response.

Now i know how to upload the file(excel format) but i have problem download
the file and view it(excel format).

after i save the file/ try to view the file(excel format) from sqldatabase,
the file already corrupted.

Here is my code:
Function GetFile()

Dim PROD_CONNEC As SqlConnection = New
SqlConnection("Server=gl;uid=LBPCOS;pwd=new1;database=DB")
Dim PROD_CMD As SqlCommand = New SqlCommand("wla_getfile",
PROD_CONNEC)
Dim PROD_DR As SqlDataReader

PROD_CMD.CommandType = CommandType.StoredProcedure

Dim PRM_CP As New SqlParameter("@Attachment_ID", SqlDbType.Int)
PRM_CP.Value = CInt("1")
PROD_CMD.Parameters.Add(PRM_CP)

PROD_CONNEC.Open()
PROD_DR = PROD_CMD.ExecuteReader


If PROD_DR.Read Then
Response.ContentType = PROD_DR("Contenttype").ToString
Response.OutputStream.Write(CType(PROD_DR("Filedata"), Byte()),
0, CInt(PROD_DR("Filesize")))
Response.AddHeader("Content-Disposition", "attachment;filename="
+ PROD_DR("Filename").ToString())
Else
Response.Write("File Not Found.")
End If

PROD_CONNEC.Close()

End Function

Any ideas? I already out of ideas.
thank you.

best regards,
GL
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top