Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query into sql not working
Message
From
17/04/2012 13:00:05
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01541855
Message ID:
01541865
Views:
34
I will from now on
what are the possible errors on could get ?

Peter



>>i have the following code:
>>
>>TEXT TO strSQL NOSHOW TEXTMERGE PRETEXT 15
>>	SELECT
>>		 f1.CLAIM_ID,
>>		 f1.CLAIMNO,
>>		 f1.WCCNO,
>>		 f1.INDEXNO,
>>		 f1.PARENT_ID,
>>		 f1.CLAIMNT_ID,
>>		 f1.ANALYST_ID,
>>		 f1.STATUTE_ID,
>>		 f1.BUSLOC_ID,
>>		 f1.DOCCURED,
>>		 f1.DCLOSED,
>>		 f1.XFERDATE,
>>		 f1.LIABDATE,
>>		 f1.STATUS,
>>		 f1.STATDATE,
>>		 f1.BOX_ID,
>>		 f1.OCCUPATION,
>>		 f1.ACCTIME,
>>		 f1.AGE,
>>		 f1.AVGWEEKLYPAY,
>>		 f1.BASERATE,
>>		 f1.BENEFITAMOUNT,
>>		 f1.WORKLIFE,
>>		 f1.WORKEXPECT,
>>		 f1.LIFEEXPECT,
>>		 f1.RTWPOTL,
>>		 f1.LIFEMED,
>>		 f1.COMPINJ,
>>		 f1.PERMPERC,
>>		 f1.MEDFLAG,
>>		 f1.PERMTOT,
>>		 f1.TTDLIFE,
>>		 f1.RESTICTIONS,
>>		 f1.ESCALATE,
>>		 f1.INFLATE,
>>		 f1.DRECVD,
>>		 f1.EXPREC,
>>		 f1.SOURCE,
>>		 f1.COMMENTS,
>>		 f1.W3,
>>		 f1.IP,
>>		 f1.MP,
>>		 f1.TP,
>>		 f1.SIFSHARE,
>>		 f1.SIFRATE,
>>		 CAST(f1.insdttm AS DATE)  AS addDate,
>>		 f2.lname,
>>		 f2.fname,
>>		 f2.mname,
>>		 f2.SSN,
>>		 f5.boxname AS boxname,
>>		 f2.onpayroll,
>>		 f3.CODE AS STATUTE,
>>		 f6.username AS analyst,
>>		 CAST(' ' AS CHAR(15)) AS signout,
>>		 carrier_id 
>>		FROM claims f1 
>>		LEFT OUTER JOIN CLAIMNT f2 
>>			ON f1.CLAIMNT_ID = f2.CLAIMNT_ID 
>>		LEFT OUTER JOIN STATUTE f3 
>>			ON f1.STATUTE_ID = f3.STATUTE_ID 
>>		LEFT OUTER JOIN filebox f5 
>>			ON f1.BOX_ID = f5.filebox_ID 
>>		LEFT OUTER JOIN SYS_USER f6 
>>			ON f1.ANALYST_ID = f6.user_ID 
>>		WHERE  1 = 0 
>>		ORDER BY 2, 1
>>
>>ENDTEXT
>>
>>THIS.iConn = SQLSTRINGCONNECT(THIS.cConnectionString)   &&&     returns 1
>>strSQL	   = CHRTRAN(strSQL, CHR(13) + CHR(10), [])
>>intResults = SQLEXEC(THIS.iConn, strSQL, [ccPRINT])                &&&& returns -1
>>_CLIPTEXT  = strSQL
>>* copied inti SSMS this query WORKS
>>
>>
>>
>>
>>why would it not work from vfp but work as query in SSMS?
>>
>>Peter
>
>
>There is no need to convert CRLF to empty string.
>I even didn't use PRETEXT 15 when it comes to SQL Server.
>That way when you put the query in the clipboard it will be structured as it is and it will be easier for you just to paste it into SSMS New Query window.
>Another suggestion. When you use SQLEXEC (or any other SQL* function) ALWAYS check for the result and show why it is not successful:
>
>THIS.iConn = SQLSTRINGCONNECT(THIS.cConnectionString)   &&&     returns 1
>intResults = SQLEXEC(THIS.iConn, strSQL, [ccPRINT])                &&&& returns -1
>IF intResults < 0
>   AERROR(laError)
>   MessageBox(laError[1,2])
>   _CLIPTEXT  = strSQL
>ENDIF
>...
>
Peter Cortiel
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform