mathieu_cupryk
asked on
Need to be able to add following formats jpg, gif, png, xls, xlsx, doc, docx, txt,csv, zip
I need to upload the file formats jpg, gif, png, xls, xlsx, doc, docx, txt,csv, zip
So this retouine only handles xlsx
Shared Sub AddAttachment(ByVal filename As String, ByVal fileContent As Byte(), ByVal interviewID As Integer)
Dim sql As New StringBuilder()
sql.Append("INSERT INTO [tbl_dotnet_attachments]([ InterviewI D],[Filena me],[Image Content],[ DateCreate d]) ")
sql.Append(" VALUES ")
sql.Append(" (@InterviewID,@FileName,@F ileContent ,GETDATE() )")
Dim conn As New SqlConnection(Configuratio nManager.C onnectionS trings("Co nnectionSt ring").Con nectionStr ing)
Dim cmd As New SqlCommand(sql.ToString(), conn)
cmd.Parameters.Add("@Inter viewID", SqlDbType.Int).Value = interviewID
cmd.Parameters.Add("@FileC ontent", SqlDbType.Image).Value = fileContent
cmd.Parameters.Add("@FileN ame", SqlDbType.VarChar).Value = filename
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
SqlConnection.ClearPool(co nn)
End Sub
So this retouine only handles xlsx
Shared Sub AddAttachment(ByVal filename As String, ByVal fileContent As Byte(), ByVal interviewID As Integer)
Dim sql As New StringBuilder()
sql.Append("INSERT INTO [tbl_dotnet_attachments]([
sql.Append(" VALUES ")
sql.Append(" (@InterviewID,@FileName,@F
Dim conn As New SqlConnection(Configuratio
Dim cmd As New SqlCommand(sql.ToString(),
cmd.Parameters.Add("@Inter
cmd.Parameters.Add("@FileC
cmd.Parameters.Add("@FileN
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
SqlConnection.ClearPool(co
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.