Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

3 ADO, 3 related DataGrids, need 1 connection 1

Status
Not open for further replies.

moki

Programmer
Dec 5, 2000
37
Hello out there,

I have a vb6 form with 3 Datagrids bound to 3 ADO ctl. and want to reduce the number of connections from 3 to 1. Can someone provide a runtime example?

Thank you.
 
Depending on your datasource & the information you're displaying it can be done easily.

You need to provide a bit more info though such as your datasource...

Do you have a relational database? (or a database design that complies?)

You can have 1 connection to that datasource even if you don't have a relational db...eg
Code:
Dim objSingleConnection As ADODB.Connection
Set objSingleConnection = CreateObject("ADODB.Connection")

'Establish Your connection to your datasource.

Dim objRecordSet1 As ADODB.RecordSet
Dim objRecordSet2.......
Dim objRecordSet3.......
...initialise..recordset
...blah...blah
Now you can say

objRecordSet1.Open Source, objSingleConnection ,..,..,..

objRecordSet2.Open Source, objSingleConnection ,..,..,..

objRecordSet3.Open Source, objSingleConnection ,..,..,..

- If you want to use a single RecordSet however, you can join your output table in SQL using the appropriate JOIN syntax & return data form all 3 tables into a single recordset object. Again this depends on your data source & design.

Seasons greetings
caf

 
Hello Caf,

Thank you for your response. My datasource is Access 97.

I understand your suggestion above but running into a roadblock on how to bind the recordset to the datagrid.

Thanks again for your help.

Have a great New Year.

Aloha,

Moki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top