Database connection

Closed
jazu - Mar 7, 2012 at 08:37 AM
 Pankaj Kumar Gupta - Mar 26, 2012 at 02:02 PM
Hello,

string connection = ConfigurationManager.ConnectionStrings["Db nameConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(connection);
con.Open();

this code is correct or not to connect sql server2005 in asp.net.plz help me.
Related:

1 response

Pankaj Kumar Gupta
Mar 26, 2012 at 02:02 PM
public static string ConString = "Data Source=SUK\\SQLEXPRESS; initial catalog=File; user id=sa; password=sp140";

SqlConnection con = new SqlConnection(ConString);
con.Open();
1