Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
C

ChetanAhire

@ChetanAhire
About
Posts
2
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to upload excel sheet (.xlxs) to sql server 2012 with vb.net and asp.net
    C ChetanAhire

    Use fileupload control and on submit button call below function and save the data in db in binary format. Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As EventArgs) ' Read the file and convert it to Byte Array Dim filePath As String = FileUpload1.PostedFile.FileName Dim filename As String = Path.GetFileName(filePath) Dim ext As String = Path.GetExtension(filename) Dim contenttype As String = String.Empty 'Set the contenttype based on File Extension Select Case ext Case ".doc" contenttype = "application/vnd.ms-word" Exit Select Case ".docx" contenttype = "application/vnd.ms-word" Exit Select Case ".xls" contenttype = "application/vnd.ms-excel" Exit Select Case ".xlsx" contenttype = "application/vnd.ms-excel" Exit Select Case ".jpg" contenttype = "image/jpg" Exit Select Case ".png" contenttype = "image/png" Exit Select Case ".gif" contenttype = "image/gif" Exit Select Case ".pdf" contenttype = "application/pdf" Exit Select End Select If contenttype <> String.Empty Then Dim fs As Stream = FileUpload1.PostedFile.InputStream Dim br As New BinaryReader(fs) Dim bytes As Byte() = br.ReadBytes(fs.Length) 'insert the file into database Dim strQuery As String = "insert into tblFiles" _ & "(Name, ContentType, Data)" _ & " values (@Name, @ContentType, @Data)" Dim cmd As New SqlCommand(strQuery) cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = filename cmd.Parameters.Add("@ContentType", SqlDbType.VarChar).Value _ = contenttype cmd.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes InsertUpdateData(cmd) lblMessage.ForeColor = System.Drawing.Color.Green lblMessage.Text = "File Uploaded Successfully" Else lblMessage.ForeColor = System.Drawing.Color.Red lblMessage.Text = "File format not recognised." _ & " Upload Image/Word/PDF/Excel formats" End If End Sub

    ASP.NET database csharp asp-net sql-server

  • Is there a control that displays a PDF and submits the pdf back to the server?
    C ChetanAhire

    Absolutely No, @Michael this is not possible as you need to code to save the PDF document in db. This can be done on submit button click.

    ASP.NET database sysadmin question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups