Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
Subject: RE: syntex error
Thread ID: 162454 Message ID: 162472 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, March 3, 2008 12:37:55 PM         
   



> >
> > Surinder had the right direction. You are using single quotes throughout. For your "CHATROOM" string literal, use double quotes"
> >
> > _SQL = 'SELECT * FROM TRN1250 WHERE UPPER( ProName ) = "CHATROOM" '
> > 

> >
> > Note the way I add spaces in this command - makes it easier to spot this kind of error.
> >
> > Ken
> > You shall know the truth - and the truth shall set you free. (John 8:33)
>
> Ken,
> Using parameters is the way to go IMHO. FOr example if backend was SQL server this 'corrected' version would fail. You need single quotes for string constants. I don't know if Oracle accepts double quotes. It's better not to think of what provider support is and use parameters IMHO.
>
> Cetin Basoz

I stand corrected. This should work though:

_SQL = "SELECT * FROM TRN1250 WHERE UPPER( ProName ) = 'CHATROOM' "


My preference would be similar to yours:

LOCAL lnHndl AS Integer, ;
      lcTextVar AS Character, ;
      lnResult AS Integer, ;
      lcSQL AS Character

lnHndl = SQLCONNECT(...)
lcTextVar = "CHATROOM"

TEXT TO lcSQL NOSHOW TEXTMERGE PRETEXT 15
   SELECT * FROM TRN1250 WHERE UPPER( ProName ) = << lcTextVar >>
ENDTEXT

lnResult = SQLEXEC(lnHndl,lcSQL,"MyResultCursor")

Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

syntex error Posted by lalit pundir @ 3/3/2008 10:42:33 AM
RE: syntex error Posted by Eric den Doop @ 3/3/2008 10:46:43 AM
RE: syntex error Posted by surinder singh @ 3/3/2008 12:05:12 PM
RE: syntex error Posted by Ken Murphy @ 3/3/2008 12:21:17 PM
RE: syntex error Posted by Cetin Basoz @ 3/3/2008 12:28:51 PM
RE: syntex error Posted by Ken Murphy @ 3/3/2008 12:37:55 PM
RE: syntex error Posted by Cetin Basoz @ 3/3/2008 12:47:33 PM
RE: syntex error Posted by Ken Murphy @ 3/3/2008 12:54:00 PM
RE: syntex error Posted by Mike Yearwood @ 3/3/2008 2:02:35 PM
RE: syntex error Posted by Ken Murphy @ 3/3/2008 2:31:51 PM
RE: syntex error Posted by Anders Altberg @ 3/3/2008 3:50:54 PM
RE: syntex error Posted by Cetin Basoz @ 3/3/2008 6:24:36 PM
RE: syntex error Posted by Mike Yearwood @ 3/14/2008 12:31:33 AM
RE: syntex error Posted by Cetin Basoz @ 3/14/2008 12:43:46 AM
RE: syntex error Posted by Mike Yearwood @ 3/14/2008 1:12:38 AM
RE: syntex error Posted by Andy Kramek @ 3/3/2008 12:52:37 PM
RE: syntex error Posted by Cetin Basoz @ 3/3/2008 1:38:51 PM
RE: syntex error Posted by Andy Kramek @ 3/3/2008 11:13:09 PM
RE: syntex error Posted by Cetin Basoz @ 3/4/2008 1:56:56 AM
RE: syntex error Posted by Cetin Basoz @ 3/3/2008 12:22:32 PM
RE: syntex error Posted by Biju Thomas @ 3/4/2008 8:59:43 AM
RE: syntex error Posted by Biju Thomas @ 3/4/2008 9:07:56 AM
RE: syntex error Posted by Ken Murphy @ 3/4/2008 11:33:20 AM
RE: syntex error Posted by suhas hegde @ 3/4/2008 6:53:41 PM
RE: syntex error Posted by tushar @ 3/4/2008 7:12:11 PM
RE: syntex error Posted by suhas hegde @ 3/4/2008 8:23:12 PM
RE: syntex error Posted by tushar @ 3/4/2008 8:35:13 PM
RE: syntex error Posted by Borislav Borissov @ 3/4/2008 9:15:07 PM
RE: syntex error Posted by tushar @ 3/5/2008 7:38:55 AM
RE: syntex error Posted by suhas hegde @ 3/5/2008 5:18:27 AM
RE: syntex error Posted by Cetin Basoz @ 3/5/2008 1:33:39 AM
RE: syntex error Posted by Biju Thomas @ 3/5/2008 4:12:54 AM
RE: syntex error Posted by Muhammad Zahid @ 3/14/2008 4:57:56 AM
RE: syntex error Posted by Mike Yearwood @ 3/14/2008 1:23:06 PM
RE: syntex error Posted by Ken Murphy @ 3/14/2008 1:35:45 PM
RE: syntex error Posted by Mike Yearwood @ 3/14/2008 1:59:55 PM
RE: syntex error Posted by Ken Murphy @ 3/14/2008 2:57:26 PM
RE: syntex error Posted by Mike Yearwood @ 3/14/2008 5:56:19 PM
RE: syntex error Posted by Ken Murphy @ 3/14/2008 7:37:58 PM
RE: syntex error Posted by Mike Yearwood @ 3/15/2008 3:33:20 AM