String connectiongstring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection sqlcon = new SqlConnection(connectiongstring);
string Brand = BDropDownList.SelectedValue.ToString();//下拉列表
string CmdText = "SELECT Model FROM [CarType] WHERE Brand=\'" + Brand + "\'";
SqlCommand sqlcom = new SqlCommand(CmdText, sqlcon);
try
{
sqlcon.Open();
SqlDataReader dr = sqlcom.ExecuteReader();
。。。。。。。。。。
}
catch (SqlException ex)
{
}
//清理
finally
{
if (sqlcon != null)
{
sqlcon.Close();
}
}
还有需要注意的是autopostback属性设置成true
selectedvalue吧
好像是
补充:
你要是用WEB控件的DropDownList就是用selectedvalue就可以