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(S tCd, oraConn);
oraConn.Open();
OracleDataAdapt er da5 = new OracleDataAdapt er(oraCMD);
DataSet ds5 = new DataSet();
da5.Fill(ds5);
if (ds5.Tables[0].Rows.Count > 0)
{
ddlState.DataSo urce = ds5.Tables[0];
ddlState.DataTe xtField = "state";
ddlState.DataVa lueField = "stateID";
ddlState.DataBi nd();
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(S tCd, oraConn);
oraConn.Open();
OracleDataAdapt er da5 = new OracleDataAdapt er(oraCMD);
DataSet ds5 = new DataSet();
da5.Fill(ds5);
if (ds5.Tables[0].Rows.Count > 0)
{
ddlState.DataSo urce = ds5.Tables[0];
ddlState.DataTe xtField = "state";
ddlState.DataVa lueField = "stateID";
ddlState.DataBi nd();
ddlState.Items. Insert(0, "(Select a State Code)");
}
da5.Dispose();
oraConn.Close() ;
thanks in advance
Comment