0
//U can go to the event of selectedIndex changed of your dropdown list
//and apply the following code.
SqlConnection con2 = null;
string str;
con2 = new SqlConnection(ConfigurationManager.AppSettings["con"].ToString());
//I have declared the connection string in con (web.config)
if (dropdownlist1.SelectedItem.ToString() == "whatever")
{
con2.Open();
str = "select * from [table] where textbox1.text = value ";
SqlCommand sqlComm1 = new SqlCommand(str, con2);
sqlComm1.ExecuteNonQuery();
sqlComm1 = null;
con2.close();
}
Now u get the desire result in string str.
U can use str for your purpose.
make sure u make the autopostback property
of your dropdown list is true.
Dnt forget to use following namespace.
using System.Data.SqlClient;
using System.Configuration;