Click here to Skip to main content
15,885,707 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
VB
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= E:\VB Project\Tansportation\Transport2003.mdb"
       con.Open()

       sql = "SELECT * FROM TblBillStatmentEntry inner join Rates on Rates.ID=TblBillStatmentEntry.FromID"

       da = New OleDb.OleDbDataAdapter(sql, con)
       da.Fill(ds, "Transport2003")

       Try

           ComboBox1.SelectedValue = sql


My question is I want to retrieve data from two tables using combobox for selecting
values of Rates Table but can not display other column data when i select any value from combobox.
Posted
Comments
John C Rayan 1-Mar-15 3:27am    
You have to specify only the columns you need in the sql. Use datasource , datatextfield and datavaluefield properties to set the Rows from your sql and what needs to be shown in your combo box and what needs to set for the selected value.
manish joshi 1-Mar-15 9:20am    
Actually I want to populate textbox using combobox.selectedvalue.
suppose if i select Pundi village in the combobox then the value of colomun name "To" and "Rate" in the Rates Table will display in the textbox1 and textbox2. I want to get all the data from Rates Table, Bill statement Table, PartyMaster. All the Three Table.
John C Rayan 1-Mar-15 10:11am    
Right! Set the DataFieldValueField and DataTextField to the Id and Name to the item (Pundi Village fields). At server side selectedIndexChanged() event, get the id value and fetch the To and Rate values from the dataadapter. You could use dataset if you want
Maciej Los 1-Mar-15 6:03am    
Please, be more specific and provide more details...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900