30 pts.
 how can i retrieve the data from sql-server2005 from multiple tables in two combo-boxes in vb6.0 using programming code
how can i retrieve the data from sql-server 2005 from multiple tables in two combo-boxes in vb6.0 using programming code

Software/Hardware used:
ASKED: April 27, 2009  9:18 PM
UPDATED: October 5, 2011  5:57 PM

Answer Wiki:
Here is an example, using ADO and an ODBC data source to connect to the database: <pre> Dim adoConnection As ADODB.Connection Dim adoRecordset As ADODB.Recordset Dim connectString As String '-Create a new connection -- Set adoConnection = New ADODB.Connection '-Create a new recordset -- Set adoRecordset = New ADODB.Recordset '-Build the connection string to use when we open the connection -- connectString = "Data Source=sql;Database=test;Uid=your_username; Pwd=your_password;" adoConnection.Open connectString adoRecordset.Open "<b>SELECT t1.field_y FROM table_1 t1 JOIN table_2 t2 ON t1.column_x = t2.column_x</b>", adoConnection ' Populate the combo Do Until adoRecordset.EOF <b>Combo1.AddItem adoRecordset!field_y</b> adoRecordset.MoveNext Loop</pre>
Last Wiki Answer Submitted:  April 28, 2009  1:49 pm  by  carlosdl   63,535 pts.
All Answer Wiki Contributors:  carlosdl   63,535 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Please post the tables structure and which data you would like to be shown.


 

There is no need to post the table structures; just adapt the above example to your needs.

Feel free to ask if you have any questions.

 63,535 pts.

 

I have one table in oracle database as student having fields as roll,name,marks & i want to display student names in combo box using OLEDB connectivity. how can i do this?

 20 pts.