PDA

Click to See Complete Forum and Search --> : Unbound Datagrid problem


chumma
Aug 9th, 2000, 04:37 AM
Hello All

I am doing the following. Please point me where I am going wrong.


public GRs as ADODB.Recordset

private Sub Query_finish

set GRs = new ADODB.Recordset
GRs.Open "SELECT * FROM WSL", adOpenStatic, adLockPessimistic, adCmdText
Debug.print GRs.Fields.Count
DataForm.Show

End Sub

'---- Data Form ---------
' Contains Adodc1 as ADODC
' Contains ManualEdit as DataGrid
' ManualEdit.DataSource = Adodc1

private Sub Form_Load ()
set Adodc1.Recordset = GRs
End Sub



When I execute the above code.. it produces empty DataGrid with 2 columns and 1 row. even though the Recordset contains lots of data ?

I replaced the above DataGrid with MSHFlexGrid and it produced perfect result. Just that I cannot use it to edit data.

Can someone point to me where I am going wrong .

Thanks a lot

Sathya

CGTS
Aug 9th, 2000, 08:03 PM
You are on the right track, but you don't need the ADODC1 control. The recordset you created is fine and you can now bind your DataGrid to that like this........


Private Sub Form_Load ()
SET ManualEdit.DataSource = GRs
End Sub

The ADODC control is just a method of connecting to a data base or file and creating a recordset to use. They are fine for some applications but your approach of creating the connection and recordset seperatly is more flexible and easier to maintain as code.

I hope this has helped......