Answered by:
How to specify (append) an integer value in the file path?

Question
-
User1106979670 posted
Hello Everyone,
I would appreciate if the following question is answered.
Scenario: I am providing 3-4 dropdowns on page load by
If (IsPostBack <> True) Then
' Populate dropdown textfields from the database
End If
Say "ddlFiles" is one of the dropdowns containing filenames as "file1", "file2" and so on. Now when the user selects say "file2", I want to download file2.
So, when I tried to debug it, since it was going to the page load again (do not know why, even though something is selected from this dropdown), I put an else for Post back there, and called selected_indexchanged function with file_value=2 as a parameter. Now how do I have to modify the following statement to download file2.csv or file[any_number].csv?
Const remoteFile As String = "/folder/subfolder/file2.csv"
I tried this but something is wrong here:
Const remoteFile As String = "/folder/subfolder/file' " & file_value & "'.csv"
It says "Constant expression is required for "file_value". What is the problem?
I'm new to this, please help me.
Thursday, April 12, 2012 11:47 AM
Answers
-
User197322208 posted
remove the '
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 12, 2012 11:51 PM
All replies
-
User197322208 posted
remove the const and put Dim
Thursday, April 12, 2012 11:55 AM -
User1106979670 posted
It gives the following error:
The remote server returned an error: (550) File unavailable (e.g., file not found, no access).
The reason, as I think (after debugging), should be the following:
Const remoteFile As String = "/folder/subfolder/file' " & file_value & "'.csv"
So, it is constructing the above path as follows:
remoteFile = /folder/subfolder/file'140'.csv?
How should I modify to get it as just file140.csv in the above path? Please help.
Thursday, April 12, 2012 11:01 PM -
User197322208 posted
remove the '
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, April 12, 2012 11:51 PM -
User1106979670 posted
Okay, I just needed to remove the single quote and it worked.
Thursday, April 12, 2012 11:52 PM