G
Guest
i have a dropdownlist that should allow the user to select a state. it should
display the 2-letter state code and the full state name. for example:
AK Alaska
CA California
....
but i am only able to display either the 2-letter state code or the full
state name (not both). my code follows:
string StCd = "SELECT DISTINCT(State_Code) stateID, Des1 state FROM
Sy_State_Code where State_Code <> 'OTH' and State_Code <> 'AA' and State_Code
<> 'AE' and State_Code <> '-'Order By State_Code ";
//stateUD is the 2-letter state code and Des1 is the full state name
oraCMD = new OracleCommand(StCd, oraConn);
oraConn.Open();
OracleDataAdapter da5 = new OracleDataAdapter(oraCMD);
DataSet ds5 = new DataSet();
da5.Fill(ds5);
if (ds5.Tables[0].Rows.Count > 0)
{
ddlState.DataSource = ds5.Tables[0];
ddlState.DataTextField = "state";
ddlState.DataValueField = "stateID";
ddlState.DataBind();
ddlState.Items.Insert(0, "(Select a State Code)");
}
da5.Dispose();
oraConn.Close();
thanks in advance
display the 2-letter state code and the full state name. for example:
AK Alaska
CA California
....
but i am only able to display either the 2-letter state code or the full
state name (not both). my code follows:
string StCd = "SELECT DISTINCT(State_Code) stateID, Des1 state FROM
Sy_State_Code where State_Code <> 'OTH' and State_Code <> 'AA' and State_Code
<> 'AE' and State_Code <> '-'Order By State_Code ";
//stateUD is the 2-letter state code and Des1 is the full state name
oraCMD = new OracleCommand(StCd, oraConn);
oraConn.Open();
OracleDataAdapter da5 = new OracleDataAdapter(oraCMD);
DataSet ds5 = new DataSet();
da5.Fill(ds5);
if (ds5.Tables[0].Rows.Count > 0)
{
ddlState.DataSource = ds5.Tables[0];
ddlState.DataTextField = "state";
ddlState.DataValueField = "stateID";
ddlState.DataBind();
ddlState.Items.Insert(0, "(Select a State Code)");
}
da5.Dispose();
oraConn.Close();
thanks in advance