G
Guest
Can somebody tell me what's wrong with this?
I am trying to bind a drop-down box to a table (states). Thanks,
//binding for the State drop-down
SqlConnection cStates = new SqlConnection
(ConfigurationSettings.AppSettings["SqlConnectionString"]);
cStates.Open();
string strTable = "GEM.states";
string strWhere = "";
strWhere = " WHERE stateid=" + lstState.SelectedItem.Value;
string strState = "SELECT statename, stateprefix as State FROM " +
strTable + strWhere + " ORDER BY statename";
adapter.Fill(ds,strTable);
lstState.DataSource = ds.Tables[strTable].DefaultView;
lstState.DataBind();
I am trying to bind a drop-down box to a table (states). Thanks,
//binding for the State drop-down
SqlConnection cStates = new SqlConnection
(ConfigurationSettings.AppSettings["SqlConnectionString"]);
cStates.Open();
string strTable = "GEM.states";
string strWhere = "";
strWhere = " WHERE stateid=" + lstState.SelectedItem.Value;
string strState = "SELECT statename, stateprefix as State FROM " +
strTable + strWhere + " ORDER BY statename";
adapter.Fill(ds,strTable);
lstState.DataSource = ds.Tables[strTable].DefaultView;
lstState.DataBind();