Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Unrecognized Escape Sequence in File Path in C#, VB.NET

Mar 10, 2015
Introduction:

Here I will explain how to solve the problem of “unrecognized escape sequence in file path'.'” while accessing file path in C#, vb.net. Actually to solve this problem we need to use double blackslashes for filepath or @ symbol before we start declaring file path.

Description:

In previous posts I explained save files in folder and download in asp.net, read or write text file in asp.net, upload and download files from database in asp.net, download multiple files as zip folder in asp.net and many articles relating to solve errors in asp.net, SQL Server, IIS, etc. Now I will explain how to solve the problem of “unrecognized escape sequence in file path'.'while accessing file path in C#, vb.net.

In one application I tried to access file from folder because of file path format problem I got error like as shown below


Actually this occurred because of file path which I mentioned in code like as shown below

C# Code


string filepath = "E:\accessdb\Sampledb.accdb";
VB.NET Code


Dim filepath As String = " E:\accessdb\Sampledb.accdb"
To fix this problem we need to use double blackslashes for filepath or @ symbol before we start declaring file path like as shown below

C# Code


string filepath = "E:\\accessdb\\Sampledb.accdb";

                                    or

string filepath = @"E:\accessdb\Sampledb.accdb";
VB.NET Code


Dim strquery As String = " E:\accessdb\Sampledb.accdb"
I hope it helps you to solve your problem. Happy Coding……

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

0 comments :

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.