damienm
asked on
ADO and DBGrid
I have used dbGrid using RDO but I want to use ADO and SQL TO populate a dbGrid?
What is your question?
If you want to use ADO, make sure you use the ADO DataGrid (MSDATGRD.OCX) and ADO Adodc (MSADODC.OCX). They work fine.
Using the ADO DataGrid with the ADO DataControl is very simple.
Set the Datasource property of the ADO Datagrid to whatever you named your ADO DataControl. Then use your SQL statement as the Recordsource property of your ADO DataControl. Refresh the ADO DataControl and that's it.
dgdData.DataSource = adoData
strSQL = "SELECT * FROM [Accounts]"
strOrder = " ORDER BY [Account Num]"
adoData.RecordSource = strSQL & strOrder
adoData.Refresh
Set the Datasource property of the ADO Datagrid to whatever you named your ADO DataControl. Then use your SQL statement as the Recordsource property of your ADO DataControl. Refresh the ADO DataControl and that's it.
dgdData.DataSource = adoData
strSQL = "SELECT * FROM [Accounts]"
strOrder = " ORDER BY [Account Num]"
adoData.RecordSource = strSQL & strOrder
adoData.Refresh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.