Hi Michael

Try using a subselect in your SQL, that will work

Select * from PointTab where obj within any (Select obj from RegionTab)
into Results

Peter Laulund
National Survey and Cadastre, Denmark







Michael Goldberg <[EMAIL PROTECTED]> - 22-09-99 14:43:21

Til:    "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:      (bcc: Peter Laulund/MI/KMS)
Vedrørende:    MI Can not delete selected records with MapBasic



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]


Reply via email to