V
Viktor Popov
Hi ,
I'm trying to populate DropDownList from data base but it doesn't work.
Could someone help me!
My code is:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");
SqlDataAdapter da = new SqlDataAdapter ("Select * FROM blek.TypeOffer ",
conn);
conn.Open();
da.SelectCommand.ExecuteReader();
DataSet ds = new DataSet();
da.Fill (ds,"Table");
DropDownList2.DataSource = ds;
DropDownList2.DataMember = "Table";
DropDownList2.DataTextField = "TypeOffer";
DropDownList2.DataValueField = "OfferID";
DropDownList2.DataBind () ;
}
I'm trying to populate DropDownList from data base but it doesn't work.
Could someone help me!
My code is:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
SqlConnection conn = new SqlConnection("Data Source=BLEK;Initial
Catalog=Estate; User ID=blek; Password=banderas");
SqlDataAdapter da = new SqlDataAdapter ("Select * FROM blek.TypeOffer ",
conn);
conn.Open();
da.SelectCommand.ExecuteReader();
DataSet ds = new DataSet();
da.Fill (ds,"Table");
DropDownList2.DataSource = ds;
DropDownList2.DataMember = "Table";
DropDownList2.DataTextField = "TypeOffer";
DropDownList2.DataValueField = "OfferID";
DropDownList2.DataBind () ;
}