I tried to display the values from oracle table into a dropdownlist which is in asp.net.I used the below code to bind the data.When I debug,the page loads completely.But it doesn’t show anything in the dropdownlist.How can I get the Oracle table values in asp.net dropdownlist.
I used the below code:
private void Page_Load(object sender, System.EventArgs e)
{
InitializeComponent();
ConnStr=”Provider=msdaora;Data Source=inchnred;User Id=inchnset;Password=inchn;”;
Conn=new OleDbConnection(ConnStr);
Conn.Open();
DataAdpt=new OleDbDataAdapter(“SELECT * FROM TBLTEST”,Conn);
DataAdpt.SelectCommand.CommandType=CommandType.Text;
DataSet ds=new System.Data.DataSet(“TBLTEST”);
DataAdpt.Fill(ds,”tbltest”);
DropDownList1=new DropDownList();
DropDownList1.DataSource=ds.Tables[0];
DropDownList1.DataTextField=”Name”;
DropDownList1.DataValueField=”EMP”;
DropDownList1.DataBind();
}
*Table name is TBLTEST
*It has columns Name,EMP