Hello
I have this query in SQL and work fine . I take the current computer date(Current_TimeStamp and I want to see the same day but from the last week
SQL Query:
DECLARE @Fecha DATE
Set @Fecha = CURRENT_TIMESTAMP
select * from RegisterTotalsHistory
where @Fecha = dateadd(dd,0, datediff(dd,-7,rth_dtDate))
I make my connection in xojo and work fine
Dim db As New ODBCDatabase
Dim sql As String
Dim rs As RecordSet
Dim Today as Date
today = New Date
//Value for the ODBC
db.DataSource = “SMPDQ”
db.UserName = “sa”
db.Password = “suprsonic”
this option work fine for see all the record in the table.
db.SQLExecute(“BEGIN TRANSATION”)
sql = "SELECT rttl_sDescription, rttl_nCount, rttl_nTotal, rta_nArrangementID, rth_dtDate FROM RegisterTotalsHistory "
sql = SQLify(sql)
rs = db.SQLSelect(sql)
But when I Modify the sql with this option that is not working
db.SQLExecute(“BEGIN TRANSATION”)
sql = "SELECT rttl_sDescription, rttl_nCount, rttl_nTotal, rta_nArrangementID, rth_dtDate FROM RegisterTotalsHistory "
sql = sql + “WHERE "
sql = sql + “’” + Today.SQLDateTime + “’”
sql = sql + " = dateadd(dd,0, datediff(dd,-7,rth_dtDate))”
sql = SQLify(sql)
rs = db.SQLSelect(sql)
The RecordSet Show the Message NILL If I use without the where the recordset is fine
Best Regards
Abimael Lopez