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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Pls Help... ASP.NET Upload File to Access Database Question

Pls Help... ASP.NET Upload File to Access Database Question

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasehelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    neknek
    wrote on last edited by
    #1

    Hi Hi All, I'm trying to write a program to Upload file to a Access Database. ( for example word, excel file ). I have read some ASP.NET's book. they have sample code upload file to a folder But Not upload to a Access Database. Can any one give me sample code for Upload file to Access. Many Many Thanks, Ken

    R A 2 Replies Last reply
    0
    • N neknek

      Hi Hi All, I'm trying to write a program to Upload file to a Access Database. ( for example word, excel file ). I have read some ASP.NET's book. they have sample code upload file to a folder But Not upload to a Access Database. Can any one give me sample code for Upload file to Access. Many Many Thanks, Ken

      R Offline
      R Offline
      rihdus
      wrote on last edited by
      #2

      hi there, plz have alook on it, http://www.stardeveloper.com/articles/display.html?article=2003031201&page=1[^] wish you solve ur problem :) Any systematic work reflects its significance for a long time, Though I m not totally against "The Prototyping".So let's discuss in depth...

      1 Reply Last reply
      0
      • N neknek

        Hi Hi All, I'm trying to write a program to Upload file to a Access Database. ( for example word, excel file ). I have read some ASP.NET's book. they have sample code upload file to a folder But Not upload to a Access Database. Can any one give me sample code for Upload file to Access. Many Many Thanks, Ken

        A Offline
        A Offline
        andyk1967
        wrote on last edited by
        #3

        Below is a sample for the upload of an image. It is not much different with word docs <%@ Import Namespace="System.io"%> <%@ Import Namespace="System.Drawing.Imaging"%> <%@ Import Namespace="System.Data.OleDb"%> <%@ Page Language="vb"%> Superfeet Private Sub Page_Load() 'Put user code to initialize the page here End Sub Sub doUpdate(s As Object, e As EventArgs) 'Making the Enter key call btnSearch_Click Page.RegisterHiddenField("__EVENTTARGET", "doUpdate") txtvolledige_tekst.Text = Server.HtmlEncode(txtvolledige_tekst.Text) Dim ConnStr As String Dim OleDb As String ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=C:\Inetpub\wwwroot\yourprojectfolder\yourdatabase.mdb;" OleDb = "Insert into sf_nieuwsartikel ( " OleDb += " titel " OleDb += " , volgorde " OleDb += " , volledige_tekst " OleDb += " , foto " OleDb += " ) values ( " OleDb += " @par_titel" OleDb += " , @par_volgorde " OleDb += " , @par_volledige_tekst" OleDb += " , @par_foto" OleDb += " )" Dim myOleDbconn As New OleDbConnection(ConnStr) Dim myOleDbcommand As New OleDbCommand(OleDb, myOleDbconn) myOleDbcommand.Connection.Open() Dim SourceFile As HttpPostedFile SourceFile = Request.Files(0) Dim br As BinaryReader = New BinaryReader(SourceFile.InputStream) Dim photo() As Byte = br.ReadBytes(SourceFile.InputStream.Length) br.Close() With myOleDbcommand.Parameters .Add(New OleDbParameter("@par_titel", OleDbType.VarChar)).Value = txttitel.Text.Trim .Add(New OleDbParameter("@par_volgorde", OleDbType.VarChar)).Value = txtvolgorde.Text.Trim .Add(New OleDbParameter("@par_volledige_tekst", OleDbType.VarChar)).Value = txtvolledige_tekst.Text.Trim .Add(New OleDbParameter("@par_foto", OleDbType.LongVarBinary, photo.Length)).Value = photo End With myOleDbcommand.ExecuteNonQuery() myOleDbcommand.Connection.Close() Response.Redirect("nieuwsartikel_tgv.html") End Sub

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

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