[newbie alert!] Populate Listbox from SQL Select query (C#)

benpaul

Newcomer
Joined
Dec 30, 2008
Messages
7
Hi All,

Sorry, I have checked as many forums as I can and also googled etc, but to be honest I dont really know what im looking for!

My problem is this... I have an application, when it first starts it displays a windows form that has a combobox populated with a list of 'events' that the user has created... this is working correctly... the user selects the 'event' that they want to administrate and this sets a variable that is available throughout the app (the EVENT ID).

now... when they click the 'select' button, it closes this first form (after setting my eventID variable) and then displays another form that I will use to display a listbox of all the records in an SQL COMPACT database table that has an 'eventid' that matches the one we set from the first forums COMBOBOX.

Anyways... what I effectivly want to do is populate a listbox using an SQL SELECT query a little like the one below...

string SqlQuery = "SELECT * FROM receipts WHERE eventid="+eventID;


I am sorry if this seems like a very mundane question, I just cant find the answer anywhere... any help would be much appreciated.
 
Back
Top