Experts Exchange connects you with the people and services you need so you can get back to work.
String connStr = ConfigurationManager.ConnectionStrings("ConnectionStringName").ToString();
SQLConnection sqlcon = New SQLConnection;
SQLCommand SQLcom = new SQLCommand;
sqlcon.ConnectionString = connStr;
sqlcom.CommandText = "SELECT Whatever FROM Table";
sqlcom.Connection = sqlcon;
String result = sqlcom.ExecuteScalar();
Open in new window
It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.
//Code for method
private void DisableAllControls(Control Page)
foreach (Control ctrl in Page.Controls)
if (ctrl is TextBox) ((TextBox) (ctrl)).Enabled = false;
else if (ctrl is Button) ((Button)(ctrl)).Enabled = false;
else if (ctrl is DropDownList) ((DropDownList)(ctrl)).Enabled = false;
else if (ctrl is ListBox) ((ListBox)(ctrl)).Enabled = false;
else if (ctrl is CheckBox) ((CheckBox)(ctrl)).Enabled = false;
else if (ctrl is CheckBoxList) ((CheckBoxList)(ctrl)).Enabled = false;
else if (ctrl is RadioButton) ((RadioButton)(ctrl)).Enabled = false;
else if (ctrl is RadioButtonList) ((RadioButtonList)(ctrl)).Enabled = false;
if (ctrl.Controls.Count > 0) DisableAllControls(ctrl);
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.