473,714 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with file path "\" storage and retrival differences

I use FolderBrowserDl g 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\\VM S\\VMSDB" . Is there a way to fix this?

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

or

"\\\\Support\\V MS\\VMSDB";

--

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

"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
I use FolderBrowserDl g 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\\VM S\\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 FolderBrowserDl g) to
the proper format.

Thanks.

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

or

"\\\\Support\\V MS\\VMSDB";

--

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

"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
I use FolderBrowserDl g 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\\VM S\\VMSDB" . Is there a way to fix this?

Thanks,
alpha


Nov 17 '05 #3

"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message
news:A2******** *************** ***********@mic rosoft.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 FolderBrowserDl g)
to
the proper format.

Thanks.

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

or

"\\\\Support\\V MS\\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***@discussi ons.microsoft.c om> wrote in message
news:A2******** *************** ***********@mic rosoft.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 FolderBrowserDl g)
to
the proper format.

Thanks.

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

or

"\\\\Support\\V MS\\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***@discussi ons.microsoft.c om> wrote in message
news:A2******** *************** ***********@mic rosoft.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 FolderBrowserDl g)
to
the proper format.

Thanks.

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

or

"\\\\Support\\V MS\\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***@discussi ons.microsoft.c om> wrote in message
news:6F******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:A2******** *************** ***********@mic rosoft.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
> FolderBrowserDl g)
> to
> the proper format.
>
> Thanks.
>
> "carion1" wrote:
>
>> @"\\Support\VMS \VMSDB";
>>
>> or
>>
>> "\\\\Support\\V MS\\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***@discussi ons.microsoft.c om> wrote in message
news:6F******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:A2******** *************** ***********@mic rosoft.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
> FolderBrowserDl g)
> to
> the proper format.
>
> Thanks.
>
> "carion1" wrote:
>
>> @"\\Support\VMS \VMSDB";
>>
>> or
>>
>> "\\\\Support\\V MS\\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.Getfi les
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("sel ect LogFilePath from Admin", conDB);
strATSPath = scGetPath.Execu teScalar().ToSt ring();
strATSPath = strATSPath.Repl ace(@"\", @"\\");
}
catch(Exception ex)
{
MessageBox.Show ("Error getting the ATS file path : " + ex.ToString()+
"Please contact your support person.", "VMS - ATS file path error",
MessageBoxButto ns.OK, MessageBoxIcon. Error);

}

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

"Mythran" wrote:

"Alpha" <Al***@discussi ons.microsoft.c om> wrote in message
news:A2******** *************** ***********@mic rosoft.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 FolderBrowserDl g)
to
the proper format.

Thanks.

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

or

"\\\\Support\\V MS\\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***@discussi ons.microsoft.c om> wrote in message
news:91******** *************** ***********@mic rosoft.com...
Well, not quite. It still doesn't work. I debug the steps and the string
var strATSPath = @"\\\\support\\ VMS\\VMSDB" but the Directory.Getfi les
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

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

Similar topics

1
3294
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 as this is the reason (security) that I want to restrict their selection. Any help on this one will be greatly appreciated. The page is using ASP.NET.
9
2044
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
2797
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 returns the filename...and just the filename. Which is what I want. In IE, however, this returns the ENTIRE local user's system path to the file
3
1179
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
1720
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 this section now. Thank you. <!-- PREVENT SOURCE CODE DOWNLOAD This section sets the types of files that will not be downloaded. As well as entering a httphandler for a file type, you must also associate that file
9
5448
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 be able to generate and compile the project on the enviroments where Visual Studio.Net is not installed. Thanks and Regards, Anubhav Jain MTS Persistent Systems Pvt. Ltd. Ph:+91 712 2226900(Off) Extn: 2431 Mob : 094231 07471
0
2846
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 and filename of the file to delete from the request.QueryString("path") so i got the above error when i try to delete the file before upload. Please anyone help me to solve out from this error. <%@ Import Namespace="System.IO" %>
5
14988
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 and why I have to do it. Hopefully someone has a suggestion... Alright, so I'm using a gps-simulation program that outputs gps data, like longitude, lattitude, altitude, etc. (hundreds of terms, these are just the well known ones). In the newer...
2
7950
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. When someone else uses the web app and tries to open a file using the remote server the error below happens. any help? **Code** C# - filepath is a valid file name which is passed via the form. System.IO.BinaryReader br = new...
0
8802
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8711
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9175
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9017
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7953
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4464
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4726
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2522
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.