0

I am trying to have a user enter values via an interface and continue to run the program but the following line (Select...) fails to work most of the time as part of the program (although it works fine when you entered in a MapBasic window).

Dim Lat As Float
Dim Lon As Float
Dim sIDENT As String
Dim sValue As String

Control StaticText
  Position 150,50
  Title "Enter ID ?"

Control EditText
  Position 150,70
  Width 50 Height 15
  ID 99
  Value " " ' default value
  Into sValue

Select Lon, Lat from TableA where sIDENT = sValue into Querry
4
  • You say it fails most of the time - when does it fail and when does it work? What data type is your column IDENT? Commented Aug 22, 2014 at 6:45
  • sorry, that was a typo IDENT is actually sIDENT. Commented Aug 22, 2014 at 15:43
  • Can you please edit you question to make the code correct? Make sure you don't have a variable names the same as a column Commented Aug 22, 2014 at 17:40
  • Modifications have been made. Commented Aug 22, 2014 at 19:49

3 Answers 3

2

You appear to have two float variables named Lon and Lat as well as selecting the same names as columns in your SQL select. Change your variable names and that should resolve the problem.

1

Add this to your code instead your 'Select' line

Dim sqlcom as string

sqlcom = "Select Lon, Lat from TableA where sIDENT = """ + sValue + """ into Query"
run command sqlcom
0

Actually I realize that the programme was causing me problems because I needed to define the svalue variable as a fixed length variable string.

Dim sValue As String *5 (for example a length 5 string)

Otherwise the selection process in the Table would not grant me a value all the time roughly only 1 out of 10 times.

2
  • No, that can't be it. Fixed length strings will have spaces added after the actual value. Does you column also hold values in this way? Commented Aug 23, 2014 at 13:57
  • The column contains 5 and 6 character strings. When the fixed length is specified the select function returns a value from a query on the table. Commented Aug 29, 2014 at 20:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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