473,511 Members | 14,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2161
@"\\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
3276
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
2031
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
2771
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
1171
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
1710
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
5421
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
2828
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
14968
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
7926
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....
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.