472,354 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Problem with file path "\" storage and retrival differences

I use FolderBrowserDlg for user to select a folder path then store it in the
sql table. I then retrieve it to concatenate in a sqlcommand text to retrive
files from that directory but it won't work because the database has it as
"\\Support\VMS\VMSDB" while the C# code expects to see
@"\\Support\\VMS\\VMSDB" . Is there a way to fix this?

Thanks,
alpha
Nov 17 '05 #1
10 2083
@"\\Support\VMS\VMSDB";

or

"\\\\Support\\VMS\\VMSDB";

--

Derek Davis
dd******@gmail.com

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
I use FolderBrowserDlg for user to select a folder path then store it in
the
sql table. I then retrieve it to concatenate in a sqlcommand text to
retrive
files from that directory but it won't work because the database has it as
"\\Support\VMS\VMSDB" while the C# code expects to see
@"\\Support\\VMS\\VMSDB" . Is there a way to fix this?

Thanks,
alpha

Nov 17 '05 #2
Thank you for the reyply. I know the proper format that C# expects. My
question is: Is there a function call or somehting that can covert the path
data I retrieve from the SQL database (stored there by FolderBrowserDlg) to
the proper format.

Thanks.

"carion1" wrote:
@"\\Support\VMS\VMSDB";

or

"\\\\Support\\VMS\\VMSDB";

--

Derek Davis
dd******@gmail.com

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.com...
I use FolderBrowserDlg for user to select a folder path then store it in
the
sql table. I then retrieve it to concatenate in a sqlcommand text to
retrive
files from that directory but it won't work because the database has it as
"\\Support\VMS\VMSDB" while the C# code expects to see
@"\\Support\\VMS\\VMSDB" . Is there a way to fix this?

Thanks,
alpha


Nov 17 '05 #3

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
Thank you for the reyply. I know the proper format that C# expects. My
question is: Is there a function call or somehting that can covert the
path
data I retrieve from the SQL database (stored there by FolderBrowserDlg)
to
the proper format.

Thanks.

"carion1" wrote:
@"\\Support\VMS\VMSDB";

or

"\\\\Support\\VMS\\VMSDB";

--


Yeah, store it in a string var and use String.Replace :)

string path = GetPathFromDb(); // Returns "\\Support\VMS\VMSDB"
path = path.Replace(@"\", @"\\");

And there ya have it :)

Mythran

Nov 17 '05 #4
Thank you. That'll work for me.

"Mythran" wrote:

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
Thank you for the reyply. I know the proper format that C# expects. My
question is: Is there a function call or somehting that can covert the
path
data I retrieve from the SQL database (stored there by FolderBrowserDlg)
to
the proper format.

Thanks.

"carion1" wrote:
@"\\Support\VMS\VMSDB";

or

"\\\\Support\\VMS\\VMSDB";

--


Yeah, store it in a string var and use String.Replace :)

string path = GetPathFromDb(); // Returns "\\Support\VMS\VMSDB"
path = path.Replace(@"\", @"\\");

And there ya have it :)

Mythran

Nov 17 '05 #5
Can you tell me what's that "@" for ? I see that in several string function
but not sure what it's for. Thanks.

"Mythran" wrote:

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
Thank you for the reyply. I know the proper format that C# expects. My
question is: Is there a function call or somehting that can covert the
path
data I retrieve from the SQL database (stored there by FolderBrowserDlg)
to
the proper format.

Thanks.

"carion1" wrote:
@"\\Support\VMS\VMSDB";

or

"\\\\Support\\VMS\\VMSDB";

--


Yeah, store it in a string var and use String.Replace :)

string path = GetPathFromDb(); // Returns "\\Support\VMS\VMSDB"
path = path.Replace(@"\", @"\\");

And there ya have it :)

Mythran

Nov 17 '05 #6
String literal. It allows you to use back slashes or whatever you want
without escaping it.

--
Derek Davis
dd******@gmail.com

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
Can you tell me what's that "@" for ? I see that in several string
function
but not sure what it's for. Thanks.

"Mythran" wrote:

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
> Thank you for the reyply. I know the proper format that C# expects.
> My
> question is: Is there a function call or somehting that can covert the
> path
> data I retrieve from the SQL database (stored there by
> FolderBrowserDlg)
> to
> the proper format.
>
> Thanks.
>
> "carion1" wrote:
>
>> @"\\Support\VMS\VMSDB";
>>
>> or
>>
>> "\\\\Support\\VMS\\VMSDB";
>>
>> --


Yeah, store it in a string var and use String.Replace :)

string path = GetPathFromDb(); // Returns "\\Support\VMS\VMSDB"
path = path.Replace(@"\", @"\\");

And there ya have it :)

Mythran

Nov 17 '05 #7
Thank you .

"carion1" wrote:
String literal. It allows you to use back slashes or whatever you want
without escaping it.

--
Derek Davis
dd******@gmail.com

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
Can you tell me what's that "@" for ? I see that in several string
function
but not sure what it's for. Thanks.

"Mythran" wrote:

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
> Thank you for the reyply. I know the proper format that C# expects.
> My
> question is: Is there a function call or somehting that can covert the
> path
> data I retrieve from the SQL database (stored there by
> FolderBrowserDlg)
> to
> the proper format.
>
> Thanks.
>
> "carion1" wrote:
>
>> @"\\Support\VMS\VMSDB";
>>
>> or
>>
>> "\\\\Support\\VMS\\VMSDB";
>>
>> --

Yeah, store it in a string var and use String.Replace :)

string path = GetPathFromDb(); // Returns "\\Support\VMS\VMSDB"
path = path.Replace(@"\", @"\\");

And there ya have it :)

Mythran


Nov 17 '05 #8
Well, not quite. It still doesn't work. I debug the steps and the string
var strATSPath = @"\\\\support\\VMS\\VMSDB" but the Directory.Getfiles
responded with directory not found. Does it just not like the Server name
instead of C drive? or is it the 4 back slashes"\\\\"?

Thanks.
try
{
scGetPath = new SqlCommand("select LogFilePath from Admin", conDB);
strATSPath = scGetPath.ExecuteScalar().ToString();
strATSPath = strATSPath.Replace(@"\", @"\\");
}
catch(Exception ex)
{
MessageBox.Show("Error getting the ATS file path : " + ex.ToString()+
"Please contact your support person.", "VMS - ATS file path error",
MessageBoxButtons.OK, MessageBoxIcon.Error);

}

//Get the latest ATS Access DB file name
try
{//@"C:\\VMS\\VMSDB"
string[] ATSFiles = Directory.GetFiles(strATSPath, "Ats*Db.mdb");
Array.Sort(ATSFiles);
NewATS= ATSFiles[ATSFiles.Length - 1];
}

"Mythran" wrote:

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
Thank you for the reyply. I know the proper format that C# expects. My
question is: Is there a function call or somehting that can covert the
path
data I retrieve from the SQL database (stored there by FolderBrowserDlg)
to
the proper format.

Thanks.

"carion1" wrote:
@"\\Support\VMS\VMSDB";

or

"\\\\Support\\VMS\\VMSDB";

--


Yeah, store it in a string var and use String.Replace :)

string path = GetPathFromDb(); // Returns "\\Support\VMS\VMSDB"
path = path.Replace(@"\", @"\\");

And there ya have it :)

Mythran

Nov 17 '05 #9

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:91**********************************@microsof t.com...
Well, not quite. It still doesn't work. I debug the steps and the string
var strATSPath = @"\\\\support\\VMS\\VMSDB" but the Directory.Getfiles
responded with directory not found. Does it just not like the Server name
instead of C drive? or is it the 4 back slashes"\\\\"?

Thanks.


Well, since you are using the @ symbol, don't escape the string..IE:

string strATSPath = @"\\support\VMS\VMSDB";

HTH :)

Mythran

Nov 17 '05 #10
Ok, I finally figured out the problem. I forgot to share the folder. Dah...
Thanks for your help.

FYI, it still needs the double slashes format for the directory.getfiles.
However, before I concatenate into the SQL query string I string.replace it
back to the single slash for it to work.

Thanks, Alpha

"Mythran" wrote:

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:91**********************************@microsof t.com...
Well, not quite. It still doesn't work. I debug the steps and the string
var strATSPath = @"\\\\support\\VMS\\VMSDB" but the Directory.Getfiles
responded with directory not found. Does it just not like the Server name
instead of C drive? or is it the 4 back slashes"\\\\"?

Thanks.


Well, since you are using the @ symbol, don't escape the string..IE:

string strATSPath = @"\\support\VMS\VMSDB";

HTH :)

Mythran

Nov 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic...
9
by: Arsen V. | last post by:
Hello, What is the suggested way to store uploaded files? 1) IMAGE type data in an SQL Database table 2) As a file in the NTFS file system Thanks, Arsen
10
by: darrel | last post by:
I have an input type="file" field that I am using to accept a file upload. This works, but I'm having problems with the filename property. In firefox, this: MyInputField.postedfile.filename ...
3
by: mavrick101 | last post by:
Can any one tell me of a Free utility that I can use to find file differences. eg asp, aspx.cs etc Thnx
0
by: yma | last post by:
Hi, I have a web.config file that contains <httpHandlers> section that causes "cannot load file..." error. If I delete this section, it is OK. Why did vb.net add this section? It does not add...
9
by: Anubhav Jain | last post by:
Hi, I am having few .net source files(.cs or .vb) and I want to dynamically generate the corresponding .net project file(.csproj or .vbproj) for them without using visual studio.So that I could...
0
by: smanisankar | last post by:
hi, the following is the full page code for uploading a file to server. since i got no idea to overwrite the file, i want delete the file if the file is already uploaded. i got the folder name...
5
blazedaces
by: blazedaces | last post by:
Ok, so you know my problem, java is running out of memory reading with SAX, the event-based xml parser intended more-so than DOM for extremely large files. I'll try to explain what I've been doing...
2
by: jjlagtap | last post by:
Hey everyone When I try to open a file i get the Exception listed below. The weird thing is it works when I run the web app locally and when i use a remote server and open a file on my computer....
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.