Can someone help me understand why the following code won't work? I'm
connected to an Access database with a connection object, but I'm unable to
populate the dropdown list box on the form.
Also, I can't seem to print diagnostics anywhere using "Response.Write" or
anything else.
private void Page_Load(object sender, System.EventArgs e)
{
string sSQL = "SELECT Statement_Id,Statement_In_Brief FROM Statements";
daStatements = new OleDbDataAdapter(sSQL,oleDbConnection1);
daStatements.Fill(dsStatements,"Statements");
DropDownList1.DataSource = dsStatements.Tables["Statements"];
DropDownList1.DataBind();
Response.Write("test");
} // end PageLoad event
Andrew de la Harpe - 19 Mar 2004 07:24 GMT
You need to set the DataTextField property to "Statement_In_Brief " and
optionally the DataValueField to "Statement_Id" before you bind.
A
> Can someone help me understand why the following code won't work? I'm
> connected to an Access database with a connection object, but I'm unable to
[quoted text clipped - 20 lines]
>
> } // end PageLoad event