In a C# 2008 application, I am creating directory paths like the following in code:
C:\\temp\\testt1\\customer.
I need to be able to save this value in columns in a sql server 2008 r2 database. I
want the above directory to be saved as:
C:\temp\testt1\customer.
I have tried to replace \\ with \ using the replace string function but I am getting escape character errors.
Thus can you tell me how to resolve this problem?
Loading
VulpesPosted Oct 16, 2012, 10:42 AM
dcPosted Oct 16, 2012, 10:38 AM
VulpesPosted Oct 16, 2012, 10:15 AM
"C:\\temp\\testt1\\customer"
to the database i.e. with doubled backslashes.
You could also use a 'verbatim' string (preceded by @) with single backslashes:
@"C:\temp\testt1\customer"
Both of these represent the same string in C#.
dcPosted Oct 16, 2012, 10:11 AM
be C:\temp\testt1\customer in the database?
VulpesPosted Oct 16, 2012, 9:59 AM
It should then save in the database as a path with single backslashes