Reputation: 11
I am working on a software in which i need to display the search query results in a listbox. mine is a medical software and im trying to display the list of medicines in the listbox. im using c# for coding under Windows Visual studio 10 platform. please help me wid this. regards
Im using Sql server management studio as backend. im using a button which when clicked will fire an event performing a query. the query is select * from Table_name i want to show the query list in the listbox..
Upvotes: 1
Views: 4301
Reputation: 3902
Within the button_click event:
That should work.
Upvotes: 2
Reputation: 5999
try something like this:
SqlDataAdapater adp=new SqlDataAdapter(querystr,"set connection string");
DataTable dt=new DataTable();
adp.Fill(dt);
List.DataSource=dt;
List.DisplayMember=dt.Columns[0].ColumnName;
Upvotes: 0