Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataEnvironment & datagrid
Message
 
To
01/11/2000 09:14:29
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00436638
Message ID:
00436782
Views:
26
Refresh your datagrid after having its datasource property:

Set DataGrid1.DataSource = DataEnvironment1.Commands("cmdRemplirGrilleLieu").Execute
datagrid1.refresh



>Hi All,
>
>On a form I have a DataGrid with its datasource being set from a command object of a DataEnvironment object. The command object is set at runtime by a SQL string according to user input (for Where and Order By clause).
>
>When a row is selected, the according data is displayed on the form for editing (each field is not bound but are filled from an ADO recordset).
>
>My problem is that when I update or add to the database (save button on the form), the grid is not refreshed although the database (Access) is being updated correctly. And if I trace it with the debugger the grid is being updated. It seems that if I let enough time between the update and the Execute command (of Dataenvironment.command), the grid will be updated.
>
>Any suggestions?
>
>If this can help here is how the grid and dataenvironment are set:
>
> strGetData = "SELECT lieuID, lieu.nom, (trim(lieu.nocivique) & ', ' & trim(lieu.rue)) as Adresse, "
> strGetData = strGetData & "trim(quartier.descr), "
> strGetData = strGetData & "trim(ville.descr), "
> strGetData = strGetData & "trim(lieu.regionUS) as Région "
> strGetData = strGetData & "FROM (((Lieu LEFT JOIN Quartier ON Lieu.QuartierID = Quartier.quartierID) "
> strGetData = strGetData & "LEFT JOIN Ville ON Quartier.VilleId = Ville.villeID) "
> strGetData = strGetData & "LEFT JOIN Organisme ON Lieu.OrganismeID = Organisme.orgID) "
> strGetData = strGetData & "LEFT JOIN TypeLieu ON Lieu.TypeLieuID = TypeLieu.typelieuID "
> strGetData = strGetData & strSQL
>
> DataEnvironment1.Commands("cmdRemplirGrilleLieu").CommandText = strGetData
> Set DataGrid1.DataSource = DataEnvironment1.Commands("cmdRemplirGrilleLieu").Execute
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform