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. General Programming
  3. .NET (Core and Framework)
  4. how to upload files to the Server path

how to upload files to the Server path

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasesysadmintoolshelptutorial
4 Posts 2 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.
  • U Offline
    U Offline
    Uma J
    wrote on last edited by
    #1

    M_SqlPathName = dsExecu.Tables(1).Rows(0)("AppSet_PhysicalPath") + Utilities.Dtgetsource.Rows(J)("FileDir") + Utilities.Dtgetsource.Rows(J)("FileName") Dim sqlcmdsql As New SqlCommand sqlcmdsql.Connection = sqlCon1 Dim fileInfo1 As FileInfo = New FileInfo(M_SqlPathName) --up to this line of code am getting the server path as D:\attachment\JON103\SQLQuery11.sql Dim script As String = fileInfo1.OpenText().ReadToEnd() --then in script am not getting any path so it throws null exceptional error SqlScript = script pls anyone chk this out and tell me how to get the server path and upload the excel file to it:confused::confused:

    L 1 Reply Last reply
    0
    • U Uma J

      M_SqlPathName = dsExecu.Tables(1).Rows(0)("AppSet_PhysicalPath") + Utilities.Dtgetsource.Rows(J)("FileDir") + Utilities.Dtgetsource.Rows(J)("FileName") Dim sqlcmdsql As New SqlCommand sqlcmdsql.Connection = sqlCon1 Dim fileInfo1 As FileInfo = New FileInfo(M_SqlPathName) --up to this line of code am getting the server path as D:\attachment\JON103\SQLQuery11.sql Dim script As String = fileInfo1.OpenText().ReadToEnd() --then in script am not getting any path so it throws null exceptional error SqlScript = script pls anyone chk this out and tell me how to get the server path and upload the excel file to it:confused::confused:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      If D:\attachment\JON103\SQLQuery11.sql does not exist, fileInfo1 will be null ('Nothing' in VB). Ensure that the file exists.

      modified on Monday, December 7, 2009 5:38 AM

      U 1 Reply Last reply
      0
      • L Lost User

        If D:\attachment\JON103\SQLQuery11.sql does not exist, fileInfo1 will be null ('Nothing' in VB). Ensure that the file exists.

        modified on Monday, December 7, 2009 5:38 AM

        U Offline
        U Offline
        Uma J
        wrote on last edited by
        #3

        Dim fileInfo1 As FileInfo = New FileInfo(M_SqlPathName) --up to this line of code am getting the server path as D:\attachment\JON103\SQLQuery11.sql Dim script As String = fileInfo1.OpenText().ReadToEnd() --then in script am not getting any path so it throws null exceptional error SqlScript = script in M_SqlPathName am getting the above directory root name, but in next stept script=fileInfo1.OpenText().ReadToEnd() it throws an error, object reference

        L 1 Reply Last reply
        0
        • U Uma J

          Dim fileInfo1 As FileInfo = New FileInfo(M_SqlPathName) --up to this line of code am getting the server path as D:\attachment\JON103\SQLQuery11.sql Dim script As String = fileInfo1.OpenText().ReadToEnd() --then in script am not getting any path so it throws null exceptional error SqlScript = script in M_SqlPathName am getting the above directory root name, but in next stept script=fileInfo1.OpenText().ReadToEnd() it throws an error, object reference

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I think my previous answer was quite clear. JUST ENSURE THAT THE FILE EXISTS, if it does not exist, you will get this error. Hint: You may use File.Exists() method to skip files that do not exist.

          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