Versions des environnements
Network:
Windows 2000 Server
Hello,
i see serveral problem areas in your code
1. your code would recreate a connection to the SQL Server everytime the button will be hit .. (and the old connection will be leaked)
2. the cursoradapter object you create is LOCAL to the Click method
that means that it is automatically destroyed when the method finishes ..
and that will close the cursor 'Customers' too
3. setting THISFORM.BindControls to .T. is only needed once ..
4. you don't bind the Column's of the grid ..
e.g. THISFORM.grdCustomers.Column1.Controlsource = 'customers.CustomerID'
some ideas to resolve these issues:
-store the Cursoradapter object reference into a Form Property ..
-create the Cursoradapter object and it's connection in the Init Event of the Form, also after refreshing it the first time there set BindControls to .T.
-make the correct grid bindings directly in the Form Designer .. it is no real advantage to write it in code ..
-close SQL connection and destroy cursoradapter object in Form Destroy Event
Regards
Christian
Précédent
Suivant
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