Dynamic database connectivity
string cs1 = ConfigurationManager.AppSettings["key"];
cn7 = new SqlConnection(cs1);
cn7.Open();
string k = "SELECT name FROM sysobjects WHERE xtype='U' ORDER BY name";
cm7 = new SqlCommand(k, cn7);
dr7 = cm7.ExecuteReader();
ListBox1.DataSource = dr7;
ListBox1.DataTextField = "name";
ListBox1.DataBind();
ListBox1.Items.Insert(0, "Select");
string cs1 = ConfigurationManager.AppSettings["key"];
cn7 = new SqlConnection(cs1);
cn7.Open();
string k = "SELECT name FROM sysobjects WHERE xtype='U' ORDER BY name";
cm7 = new SqlCommand(k, cn7);
dr7 = cm7.ExecuteReader();
ListBox1.DataSource = dr7;
ListBox1.DataTextField = "name";
ListBox1.DataBind();
ListBox1.Items.Insert(0, "Select");
No comments:
Post a Comment