Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 6 Sql Question using dates
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP3
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
00953528
Message ID:
00953531
Vues:
15
This message has been marked as the solution to the initial question of the thread.
Tom,

MS SQL Server doesn't have date data type, only datetime. You've to either convert datetime from cursor into date or date from the textbox to the datetime.
ldDate = Thisform.cntStartDate.txtDate.Value 
* Date to DatetTime
ltDateTime = DTOT(ldDate+1) - 1 
...
AND cuDetail.CreatedDate <= ldDateTime

* DatetTime to Date
...
AND TTOD(cuDetail.CreatedDate) <= ldDate
>Cumulative totals:
>
>Desired:
>
>1. User enters a date in a textbox.
>
>2. The textbox format is D && for date / /
>
>3. Crusors (cuDetail and cuRework) are created using SQL Pass thru and work fine with the date entry via the textbox.
>
>4. The two cursors are combined as shown below, and without the line AND cuDetail.CreatedDate < = ldDate, work as desired.
>
>5. Using the value from the textbox gives an error “Operator/Operand type mismatch.
>
>6. I have tried CTOD, and other functions to convert the date with no luck.
>
>7. How do I get this to work with the date selection entered by the user via the textbox?
>
>
>* ldDate = Thisform.cntStartDate.txtDate.Value  && This will crash and burn.
>* ldDate = {^2004/08/06 11:59:59 PM}  && This works.
>
>Select cuDetail.PartNumber, cuDetail.ReworkNumber, cuDetail.Kanban, ;
>	SUM(cuDetail.TotalOK) AS CtTotal, SUM(cuDetail.OK) AS CtOK, ;
>	SUM(cuDetail.Reworked) AS CtReworked, SUM(cuDetail.Rejected) AS CtRejected ;
>	from cuReworkNumber, cuDetail ;
>	WHERE cuReworknumber.ReworkNumber = cuDetail.ReworkNumber ;
>	AND cuDetail.CreatedDate <= ldDate   ;
>	GROUP BY cuDetail.ReworkNumber, cuDetail.PartNumber ;
>	into cursor cuCumulativeTotal ;
>	ORDER BY cuDetail.ReworkNumber, cuDetail.PartNumber
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform