Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Assign ado datafieldsto dataGrid cols & populate
Hello everyone
I am attempting to assign data fields from access 2003 to a dataGrid in VB6. I do not want to use the the properties wizard to assign the data, I want to do it using code. This is what I have, but the dataGrid displays blank. Col headings do display as specified. The record set is defined as such:
With rstCatPrimary
.ActiveConnection = conMMM
.CursorLocation = adUseClient
.Source = "select id, primaryCode, desc from CatPrimary"
.LockType = adLockOptimistic
.Open
.MoveFirst 'move the rec pointer to the top of the data set
End With
With grdData
.
.
'Col Headers *******
.Columns(0).Caption = "Primary Key"
.Columns(1).Caption = "Primary Description"
'Col data assignments ****** (NEXT 2 LINES IS THE PROBLEM)
.Columns(0).DataField = rstCatPrimary!primarycode
.Columns(1).DataField = rstCatPrimary!Desc
End With
The grid does populate if I use the properties wizard, so the dataset is solid
Thanks in advance
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement