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. .xls file as linked server

.xls file as linked server

Scheduled Pinned Locked Moved ASP.NET
databasesysadminannouncementworkspace
5 Posts 4 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.
  • B Offline
    B Offline
    bubberz
    wrote on last edited by
    #1

    I've setup, through DTS, my linked server as an .xls file. What I want to do is have a .aspx page which allows the user to upload a .xls file to the following database server directory: C:\TestSaving\ I've got the code to read the file once it's in the directory and select all the rows from the .xls file and insert them into a table, but I can't get the file to save into the database server directory above. I had to hand create it to get the whole update process to work. Here's my code: *************** Dim getmyFile As HttpPostedFile = myfile.PostedFile Label2.Text = "Line 76" If IsNothing(getmyFile) Then Label2.Text = "Please select a file to upload" Else If getmyFile.ContentLength = 0 Then Label2.Text = "Cannot upload zero length File" Else Dim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName) Server.MapPath("//db2") getmyFile.SaveAs("C:\TestSaving\" & ServerFileName) Label2.Text = "Successful upload to C:\TestSaving\" & ServerFileName **************** Any suggestions are welcome! Thanks!

    R M 2 Replies Last reply
    0
    • B bubberz

      I've setup, through DTS, my linked server as an .xls file. What I want to do is have a .aspx page which allows the user to upload a .xls file to the following database server directory: C:\TestSaving\ I've got the code to read the file once it's in the directory and select all the rows from the .xls file and insert them into a table, but I can't get the file to save into the database server directory above. I had to hand create it to get the whole update process to work. Here's my code: *************** Dim getmyFile As HttpPostedFile = myfile.PostedFile Label2.Text = "Line 76" If IsNothing(getmyFile) Then Label2.Text = "Please select a file to upload" Else If getmyFile.ContentLength = 0 Then Label2.Text = "Cannot upload zero length File" Else Dim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName) Server.MapPath("//db2") getmyFile.SaveAs("C:\TestSaving\" & ServerFileName) Label2.Text = "Successful upload to C:\TestSaving\" & ServerFileName **************** Any suggestions are welcome! Thanks!

      R Offline
      R Offline
      Rocky Moore
      wrote on last edited by
      #2

      Did you assign ASP.NET (Network Services on Win 2003 server) write access to that folder? Rocky <>< My Blog[^]

      A 1 Reply Last reply
      0
      • R Rocky Moore

        Did you assign ASP.NET (Network Services on Win 2003 server) write access to that folder? Rocky <>< My Blog[^]

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

        I gave all the user categories in the folder Full Access? Is there another way to assign rights?

        R 1 Reply Last reply
        0
        • B bubberz

          I've setup, through DTS, my linked server as an .xls file. What I want to do is have a .aspx page which allows the user to upload a .xls file to the following database server directory: C:\TestSaving\ I've got the code to read the file once it's in the directory and select all the rows from the .xls file and insert them into a table, but I can't get the file to save into the database server directory above. I had to hand create it to get the whole update process to work. Here's my code: *************** Dim getmyFile As HttpPostedFile = myfile.PostedFile Label2.Text = "Line 76" If IsNothing(getmyFile) Then Label2.Text = "Please select a file to upload" Else If getmyFile.ContentLength = 0 Then Label2.Text = "Cannot upload zero length File" Else Dim ServerFileName As String = Path.GetFileName(myfile.PostedFile.FileName) Server.MapPath("//db2") getmyFile.SaveAs("C:\TestSaving\" & ServerFileName) Label2.Text = "Successful upload to C:\TestSaving\" & ServerFileName **************** Any suggestions are welcome! Thanks!

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          bubberz wrote: but I can't get the file to save into the database server directory Have you tried to run your sample code in debug to see what is going on in there? Does the file gets actually uploaded? Do you get any error or it simply does not save the file to disk?

          1 Reply Last reply
          0
          • A Anonymous

            I gave all the user categories in the folder Full Access? Is there another way to assign rights?

            R Offline
            R Offline
            Rocky Moore
            wrote on last edited by
            #5

            Not quite sure what you mean by "User Categories". If you bring up the folder in explorer (file explorer), right click and select Properties and then click the Security tab on the Properites window. Where it says "Group aor user names:", you need to have in the list "ASP.NET" (if you are using Windows 2003 server, that would be "Network Services"). That account should have full write access to the folder. Rocky <>< My Blog[^]

            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