MS SQL SERVER 2008r2 connection with Visual studio 2012

Total Post:341

Points:2389
C# 
C#
 1453  View(s)
Ratings:
Rate this:

SqlConnection con = new SqlConnection("Data source=BIMESH-PC\SQLEXPRESS;initial catalog=LibrSystem;integrated security=true");

In this code the escape sequence is not acceptable.....

please rectify this code....

  1. Post:145

    Points:1019
    Re: MS SQL SERVER 2008r2 connection with Visual studio 2012

    Hi Ankit,

    You could try either

    SqlConnection con = new SqlConnection(@"Data source=BIMESH-PC\SQLEXPRESS;initial catalog=LibrSystem;integrated security=true");

    SqlConnection con = new SqlConnection("Data source=BIMESH-PC\\SQLEXPRESS;initial catalog=LibrSystem;integrated security=true");

Answer