[V4RB2] What's wrong with SQLSelect?

Kem Tekinay ktekinay at mactechnologies.com
Tue Mar 29 10:35:03 CST 2005


On 3/29/05 3:15 AM, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:

> I am sorry I have not understand where is problem.
> 
> Search is fine, BUT ?

Let me try again with a better example.

Again, my REALbasic code is this:

  if find = "" then
    sql = "SELECT * FROM Zip_Codes"
  else
    sql = "SELECT * FROM Zip_Codes WHERE " + _
        "Zip_Code LIKE '" + find + "%' " + _
        "OR City LIKE '" + find + "%' " + _
        "OR State LIKE '" + find +"%'"
  end if
  
  try
    curs = gDB.SQLSelect( sql, EVCursorLocation.kClientSide,
EVLockType.kReadOnly, EVCursorDirection.kForwardOnly )
  catch err as VException
    MsgBox gDB.ErrString
  end try

My database has 7 fields with 84,000 records, but, for this example, we'll
say it has 3 fields and three records:

Zip_Code     City            State
10454        Bronx           NY
10530        Hartsdale       NY
10532        Hawthorne       NY

If I set the find variable to "105", the SQL command becomes:

 SELECT * FROM Zip_Codes WHERE Zip_Code LIKE '105%' OR City LIKE '105%'
    OR State LIKE '105%'

This properly selects two records in both Valentina and REALdatabase.

Now I set find = "NY", making the SQL command:

 SELECT * FROM Zip_Codes WHERE Zip_Code LIKE 'NY%' OR City LIKE 'NY%'
    OR State LIKE 'NY%'

This properly finds three records in REALdatabase, but finds nothing in
Valentina. And that's the problem.

__________________________________________________________________________
Kem Tekinay                                                 (212) 201-1465
MacTechnologies Consulting                              Fax (914) 242-7294
545 Eighth Avenue, Suite 401                          Pager (917) 491-5546
New York, New York 10018                    http://www.mactechnologies.com

To join the MacTechnologies Consulting mailing list, send an e-mail to:
  mactechnologies_consulting-subscribe at yahoogroups.com





More information about the Valentina mailing list