Click here to Skip to main content
16,004,991 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
OleDbConnection conn;
OleDbCommand comm;
OleDbDataReader dr;
conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\data1\jana.mdb");
comm = new OleDbCommand("insert into mans1 values('" + TextBox1.Text + "','" + TextBox2.Text + "')", conn);
conn.Open();
dr = comm.ExecuteReader();
conn.Close();

Here i got a error about the ms access connection string(unrecognized escape sequence).........

Also i tried { @"Data Source=C:\data1\jana.mdb" AND
"Data Source=C:\\data1\\jana.mdb" }......


what should i do......
Posted
Updated 21-Jun-11 10:36am
v2

try this:
string str="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\\data1\\jana.mdb";

conn = new OleDbConnection(str);


hope this helps :)
 
Share this answer
 
Collect your connection string in String veriable and runtime check what you have get in string veriable, u may get like (c:data1jana.mdb)
 
Share this answer
 
hi,
try this
conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\data1\jana.mdb");

and also check your connection string from here[^]
 
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