[V4MD] SELECT with AND syntax

Irv Kalb Irv at furrypants.com
Sat Sep 20 13:29:07 CDT 2008


Hi,

I need help with SQL syntax on what should be a simple SELECT 
statement.  I want to select all records from a table where one field 
equals one value and another field equals another value,  The value 
of the first field may have spaces in it, and I found though 
experimentation that I need to enclose such fields with single quote 
characters.  Here's what I am trying:

on mMatchLabelAndMovie me, theCurrentLabel, theCurrentMovie

   cursor = poDB.SqlQuery("SELECT * FROM Main where (FrameLabel = " & 
"'" & theCurrentLabel & "'" & ")" & " AND (MovieName = " & 
theCurrentMovie & ")")

...
end

The specific query string that gets built from the first time this is 
called is this:

"SELECT * FROM Main where (FrameLabel = '#E1_Goals: The Presence of 
the Past') AND (MovieName = HI)"

This looks right to me, the values are exactly what I want to find, 
and I know that there is a single record that matches this criteria.

But when I execute this, I get back this:

[#errNumber: 333056, #errNumberHex: "0x51500", #errString: 
"Identifier "HI" is not found."]

I'm hoping that someone can tell me what's wrong with my SQL syntax here.

If it helps, I'm trying to convert this from V12, and my calls to get 
this information from V12 were like this:

   --  mSetCriteria(pxTableMain, "FrameLabel", "=", theCurrentLabel)
   --  CheckV12Error()
   --  mSetCriteria(pxTableMain, "and", "MovieName", "=", theCurrentMovie)
   --  CheckV12Error()
   --  mSelect(pxTableMain)
   --  CheckV12Error()


Thanks,

Irv

-- 

Multimedia R Us


More information about the Valentina mailing list