1

I made a Query in Mapbasic like :

Dim query As String
query = "Select * from some_table"

How to run query to form table? Is it possible to save selected value in variable without forming table?

4

You can just run the SQL command right in the MapBasic code:

Select * from some_table into mySelection

If you do need to store the SQL query in a string (dynmic SQL string etc) you can execute it using RunCommand

Dim query As String
query = "Select * from some_table into mySelection"
Run Command query 

In order to get the values from the table you need to use Fetch

Dim value as String
Fetch First From mySelection
value = mySelection.{ColumnName}

You will have to write a loop using Fetch First and Fetch Next to loop over all the records to do something with each one.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.