Change your Sub as follows, 
This will solve the problem

Sub Query1

 fetch first from TableB
 do while not eot(TableB)
 Dim a as object
 a = TableB.obj
 Select * from TableA where obj contains TableA.obj into Results 
 fetch next from tableB
 Loop
  Delete from Results 

End Sub

Hope this helps


From:          Michael Goldberg <[EMAIL PROTECTED]>
To:            "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
Subject:       MI Can not delete selected records with MapBasic
Date:          Wed, 22 Sep 1999 08:43:21 -0500

Dear List,

I have a simple MapBasic application that selects all the points that fall
within a group of polygons and then is supposed to delete those selected
points.  The query works fine but it does not delete the records.  When I
run the application MI says that it can not delete from a view.  I've tried
everything I can think of.   Any help would be greatly appreciated.  I've
attached the code below:

'*This application deletes all the objects that fall within a table of
polygons.  It asks the user to open two tables.  

'* Include
Include "G:\MapInfo\MapBasic\mapbasic.def"

'*Declares
Declare Sub main
Declare Sub Query1

'*Funcion: main
'*Purpose: main control
Sub main

Dim Table1 as String
Dim Table2 as String
Dim Results as String
Table1 = "TableA"
Table2 = "TableB"

Note "Please, select a point table."

'*Open tables and create map window
Table1 = FileOpenDlg("","","TAB","Open Table")

If (Table1 <> "") Then
        Open Table Table1 As TableA
Else
        Note "No table selected."
End If

Note "Please, select a polygon table."

Table2 = FileOpenDlg("","","TAB","Open Table")
If (Table2 <> "") Then
        Open Table Table2 As TableB
Else
        Note "Second table not selected.  Exiting program."
End If

Map From TableB, TableA

Set Map Zoom Entire

Call Query1()

End Sub

'*Function: Select all points that fall within the polygons.
Sub Query1

Select * from TableA, TableB where TableB.obj contains TableA.obj into
Results 
Browse * from Results

Delete from Results

End Sub

Thank-you,

Michael Goldberg
City of San Antonio Planning Department
Data Management & CAD
[EMAIL PROTECTED]
(210) 207-6533

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
===================================================
Aditya 
Executive (Systems) 
Information Systems Department
GCMMF, Anand
E-mail me at :[EMAIL PROTECTED]
Web Site: http://www.amul.com
===================================================
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to