<configuration> <appSettings> <add key="connectionString" value="Server=.\\SQLEXPRESS; database=MLM; Trusted_Connection=True"/> </appSettings> ....
SqlConnection con; SqlCommand cmd; SqlDataAdapter adp; DataSet ds; protected void Page_Load(object sender, EventArgs e) { string connecStr = System.Configuration.ConfigurationSettings.AppSettings["connectionString"]; con = new SqlConnection(connecStr); cmd = new SqlCommand("Select * from tblNodeTree"); cmd.Connection = con; ds = new DataSet(); adp = new SqlDataAdapter(cmd); adp.Fill(ds, "tblNodeTree"); // This line shows error message "instance failure" GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); }
string connecStr = System.Configuration.ConfigurationSettings.AppSettings["connectionString"]; With string connecStr= "Server=.\\SQLEXPRESS; database=MLM; Trusted_Connection=True";
connectionStrings
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)