Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send DateTime / TimeStamp fields to FierBird
Message
From
17/11/2007 09:10:12
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
Database:
Firebird
Miscellaneous
Thread ID:
01269647
Message ID:
01269651
Views:
15
>Hi all
>
>I have the following SQL Pass Through, but it goes to the backend as a string rather than as a TimeStamp field
>
>
>pdFromDt = DTOT(ThisForm.txtdFromDt.VALUE)
>
>TEXT TO lcSQL TEXTMERGE NOSHOW
>	SELECT 1 AS iOrder, mA.iID AS iPID, mA.iID as iGID, '<<pdFromDt>>' AS tDt,
>			mA.iID AS iAcctID, CASE WHEN mA.cDrCr = 'DR' AND mA.bOpBal > 0 THEN mA.bOpBal
>				ELSE CASE WHEN mA.cDrCr = 'CR' AND mA.bOpBal < 0 THEN -mA.bOpBal
>				ELSE CAST(0 AS DOUBLE PRECISION) END END AS bDebit,
>			CASE WHEN mA.cDrCr = 'CR' AND mA.bOpBal > 0 THEN mA.bOpBal
>				ELSE CASE WHEN mA.cDrCr = 'DR' AND mA.bOpBal < 0 THEN -mA.bOpBal
>				ELSE CAST(0 AS DOUBLE PRECISION) END END AS bCredit, 'O' AS cSource
>		FROM mAccounts mA
>ENDTEXT
>
>
>IF NOT THIS.AllRecordsSelected()
>	TEXT TO lcSQL ADDITIVE TEXTMERGE NOSHOW
>			WHERE mA.iID IN (SELECT ID
>							FROM AccountsSelected
>							WHERE TRIM(JobID) = '<<THIS.cJobID>>')
>	ENDTEXT
>ENDIF
>
>MESSAGEBOX(lcSQL)
>SQLPT(lcSQL, "curLedger")
>SELECT curLedger
>BROWSE NORM
>
>SQLPT() is a wrapper for SQLEXEC(). I have also tried to send the datetime value using a ? but that raises and error.
>
>Please advise.

Normally it's:
pdFromDt = ThisForm.txtdFromDt.VALUE

TEXT TO lcSQL TEXTMERGE NOSHOW
	SELECT 1 AS iOrder, mA.iID AS iPID, mA.iID as iGID, ?m.pdFromDt AS tDt
SQLPT code seems to be the culprit. Maybe you can edit it to accept a parameter object. Something like:
oParm = createobject('empty')
addproperty(oParm, "pdFromDt", ThisForm.txtdFromDt.VALUE)

TEXT TO lcSQL TEXTMERGE NOSHOW
	SELECT 1 AS iOrder, mA.iID AS iPID, mA.iID as iGID, ?toParm.pdFromDt AS tDt
*...

SQLPT(lcSQL, "curLedger", oParm)


* SQLPT
lparameters tcSQL,tcAlias,toParm
I wouldn't use a wrapper that can't handle parameters.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform