Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / March 2004

Tip: Looking for answers? Try searching our database.

Populating a Dropdown Listbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Curt Emich - 19 Mar 2004 07:13 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.