Hi Nicolas,
 
I think you should look at the Run Command option which lets you build a string 
and then run the string afterwards
 
Dim  szCmdStr, szTab, szCond As String
 
szTab  = TableInfo(1, TAB_INFO_NAME)
szCmdStr = "Select * From " & szTab
 
If <some condition is met> then
   '**Please note that you now need to add the quotationmarks explicitly
   szCond = "LASTNAME = " & chr$(34) & "M�LLER" & chr$(34)
end if
If <some other condition is met> then
   If szCond = "" Then
     '**Please note that you now need to add the quotationmarks explicitly
      szCond = "FIRSTNAME = " & chr$(34) & "PETER" & chr$(34)
   else
     '**Please note that you now need to add the quotationmarks explicitly
      szCond = szCond & "AND FIRSTNAME = " & chr$(34) & "PETER" & chr$(34)
   end if
end if
 
Run Command szCmdStr & szCond
 
HTH,
Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
5260 Odense S.
Denmark
 
Tel   + 45 6311 4900
Dir   +45 6311 4908
Mob +45 5156 1045
Fax  + 45 6311 4949
E-mail [EMAIL PROTECTED]
http://www.cowi.dk <http://www.cowi.dk/> 

________________________________

From: Nicolas Muszynski [mailto:[EMAIL PROTECTED]
Sent: Fri 03-Dec-04 20:26
To: [EMAIL PROTECTED]
Subject: MI-L using a string for a where clause



Hello all,

In mapbasic I am trying to code a "select * from table_name where
certain_conditions" clause but I need to have the table_name variable as
well as the certain_conditions.  MapBasic doesn't seem having any
trouble reading a variable of type string for the table_name but it
doesn't seem to read the variable Certain_conditions for the where
clause conditions.  The only way the where clause works is if it is hard
coded.  Any ideas or solutions?

Thank You

Nicolas Muszynski



Reply via email to