Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
string str ="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Atharv.accdb;Persist Security Info=False;";


Error	1	Unrecognized escape sequence	

how to solve this?
Posted
Updated 18-May-15 2:00am
v2
Comments
[no name] 18-May-15 7:27am    
Missing the path of your datasource connection,you can use \\ in the source.

You must escape the back slashes by prefixing them with another back slash:
C#
string str ="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Program Files\\Atharv.accdb;Persist Security Info=False;";
 
Share this answer
 
v2
Just add @ before the connection string like :
C#
string str =@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Atharv.accdb;Persist Security Info=False;";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900