//SQL PART
Line 1 : string dd = "Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Users\HEX\Documents\Visual Studio 2008\Projects\cventry_address_book_0.1\cventry_address_book_0.1\addressbook.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True";
Line 2 :SqlConnection sqlconobj = new SqlConnection(dd);
Line 3: sqlconobj.Open();
---------Errors Output------------
Unexpected character'\'
In C# the backslash character has special meaning.
You need to double it or prefix your entire string with the Verbatim character @
And there is no need to put a double quote before and after the file name.
Formatting rules (the ending semicolon) allows spaces in path or file name for the AttachDbFileName
string dd = @"Data Source=.\SQLEXPRESS;AttachDbFilename=" +
@"C:\Users\HEX\Documents\Visual Studio 2008\" +
@"Projects\cventry_address_book_0.1\cventry_address_book_0.1" +
@"\addressbook.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With