Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting records using SQL Delete in Grids
Message
 
 
À
02/08/2001 14:14:30
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00538999
Message ID:
00539178
Vues:
10
Henry,

First, to make the mprimedelete, mseconddelete variables visible thru your form make them the properties of the form. Second, when user clicks on the column only text1.value of this column changes. To get values for current grid row you have to reference the fields of underlying table.
If !thisform._grid2.visible
  Thisform.mprimedelete  = EVAL(thisform._grid1.column1.text1.controlsource)
  Thisform.mseconddelete = EVAL(thisform._grid1.column2.text1.controlsource)
else
  Thisform.mprimedelete  = EVAL(thisform._grid2.column1.text1.controlsource)
  Thisform.mseconddelete = EVAL(thisform._grid2.column2.text1.controlsource)
endif
>Hello Gurus:
>
>I have 2 grids on a form. The first grid displays the fields from a table (only2 fields exist in the table). The second grid will be visible when a sarch has been made for a particular record.
>
>The problem: If the user clicks on the first column, say row two on the grid, then, the value of column1.text1 is stored in a variable and the value of column2.text1 in another variable. Now the user can click delete to delete the record from the table. This should happen to only that particular record. If the user clicks the column2, say row 3, then column2.text1 will be stored in a variable and column1.text1 of the same row in another varaibale for deletion later. This is the code I have in the Click Event of the two grids (this one, as an example for grid1):
>
>If !thisform._grid2.visible
> mprimedelete = thisform._grid1.column1.text1.value
> mseconddelete = thisform._grid1.column2.text1.value
>else
> mprimedelete = thisform._grid2.column1.text1.value
> mseconddelete = thisform._grid2.column2.text1.value
>endif
>
>The Click Event of the Delete button has the following code:
>
>DELETE FROM rev_locations;
> WHERE alltrim(rev_locations.primaryloc) == alltrim(mprimedelete) .and.;
> alltrim(rev_locations.secondloc) == alltrim(mseconddelete)
>
>Note that only the select row should be deleted, since either column1 or colum2 can have repeated values. So I am looking at deleting a very specific row that the user has chose. With the aboe, codes, the memory variable do not appear to be capturing the right values from teh columns for deletion later.
>
>Thanks in advance for your suggestions.
>
>- Ravi
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform