[GIS] How to handle select query to return numeric value

mapbasicmapinfo

I have the following select Query :

Dim count As Integer
Select count(*) as mycount from some_table into temp_table
Fetch First From temp_table
count = some_table.mycount

But it sends error:

Expression does not evaluate to string

Now when I saved temp_table to *.tab file it has char column.How to make some_table.mycount a number?

But when the Query is

Select count(*) from some_table into temp_table

It would work but column name is random.

Best Answer

Try this in stead:

Dim count As Integer
Select count(*) "mycount" from some_table into temp_table
Fetch First From temp_table
count = temp_table.mycount