.xls file as linked server
-
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!
-
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!
-
-
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!
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?
-
I gave all the user categories in the folder Full Access? Is there another way to assign rights?
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[^]