Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Query String error.

Can someone please inform me what's missing?

If I use a tdate = 5 then I get data properly, if I use a variable I get no data.

tdate = Right(Year(todaydate),1)
SQLStringVar = "SELECT  ZGL.FISL,ZGL.YR, GLC.ACT, GLC.DESC30
                         FROM D100.ZGLP ZGL,  D100.GLCH GLC
                         WHERE ZGL.YEAR = tdate"
0
cyle
Asked:
cyle
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
SQLStringVar = "SELECT  ZGL.FISL,ZGL.YR, GLC.ACT, GLC.DESC30
                         FROM D100.ZGLP ZGL,  D100.GLCH GLC
                         WHERE ZGL.YEAR = " & tdate
If you put it inside the string, it is no longer a variable... you need it as a string, the "&" operator will take care of both the conversion of tdate to a string and the concatenation with the SELECT-string.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now