How to load data from db to combobox?
-
Dear, I start programming a very small project called "CD Collection" for my self learning which is using C Sharp 2005 and MS Access 2007. I would love you to instruct me if possible. I can insert into table (eg: tbl_user (uID, username)) normally but I've no idea how to load these data to combobox (in other form - tbl_cd (cd_id, music_code, uID, cd_set_id)). So, what do I've to code? 1. How to load data from db to combobox? 2. After successfully loaded, I want to know how do I insert uID(from combobox) back to uID in tbl_cd? Many thanks,
Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner
-
Dear, I start programming a very small project called "CD Collection" for my self learning which is using C Sharp 2005 and MS Access 2007. I would love you to instruct me if possible. I can insert into table (eg: tbl_user (uID, username)) normally but I've no idea how to load these data to combobox (in other form - tbl_cd (cd_id, music_code, uID, cd_set_id)). So, what do I've to code? 1. How to load data from db to combobox? 2. After successfully loaded, I want to know how do I insert uID(from combobox) back to uID in tbl_cd? Many thanks,
Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner
If you set the datasource of the combobox to be the dataset you get back from the DB, you set the displaymember property to set which column the combobox should show.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
If you set the datasource of the combobox to be the dataset you get back from the DB, you set the displaymember property to set which column the combobox should show.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Would you mind to give me a code? Yours,
Chuon Visoth Angkor Wat - Cambodia asp.net - c sharp beginner
From The NorthWind DB:
//Create DataSet Member DataSet ds = new DataSet(); //Fill The DataSet With Data: //CustomersAndOrders - Function that returns DataSet (one DataTable Of Customers and one Of Orders. ds = empLogic.CustomersAndOrders(); //Show The Table Source cmbCustomers.DataSource = ds.Tables["Customes"]; //Witch Culomn We Want To Show cmbCustomers.DisplayMember = "CompanyName"; //Save The CustomerID Key For Future Use cmbCustomers.ValueMember = "CustomerID";