Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: jared fernandez
  Where is jared fernandez?
 Caloocan City
 Philippines
 jared fernandez
 Tags
Subject: RE: Record No. 1
Thread ID: 189282 Message ID: 189284 # Views: 1 # Ratings: 1
Version: Visual FoxPro 6 Category: Databases, Tables and SQL Server
Date: Thursday, August 14, 2008 9:16:06 AM         
   


> I got a checkbox in a grid. What I want is to update the items with checked checkbox. But whenever I do it, record number 1 is also changed even it is not included (its checkbox is false)
>
> Here's my code :
>
>
select mygridcursor 
> scan				
> update table ;
> 	set remarks1 = remarks ;							
> 	where table.prno = thisform.txtprno.value;								
> 	and table.item_no = mygridcursor.item_no 
> 	and mygridcursor.checkitem = .t.
> endscan	
> =tableupdate(.t., .t., "table")

>

That sounds as if your Where condition sometimes may include more than the one row you want to update.
The easiest way might be "Replace" instead of SQL Update - because the active row in your grid always equals the record pointer position of the underlying alias.

(The other way would be introducing a surrogate primary-key column (which is required when you want to use SQL anyway).)


hth
-Stefan

ENTIRE THREAD

Record No. 1 Posted by jared fernandez @ 8/14/2008 9:05:35 AM
RE: Record No. 1 Posted by Stefan Wuebbe @ 8/14/2008 9:16:06 AM
RE: Record No. 1 Posted by jared fernandez @ 8/14/2008 9:19:27 AM
RE: Record No. 1 Posted by Stefan Wuebbe @ 8/14/2008 9:22:22 AM
RE: Record No. 1 Posted by jared fernandez @ 8/14/2008 9:30:47 AM