Hi Guys,
I am using the following code to open a dialog to get two dates.
I need to use the dates as values to filter an SQL table in a date range. How do I convert the Xbasic Dates to SQL syntax?
It seems the SQL must be without double quotes, which is what you get when converting with DTOC(vd_first_date,"1/")
Is there a function to substitute the double quotes for single quotes?
eg WHERE APPLICATION_DATE BETWEEN :vd_first_date AND :vd_last_date
I am using the following code to open a dialog to get two dates.
Code:
DIM SHARED vd_first_date as D DIM SHARED vd_last_date as D DIM SHARED varC_result as C ok_button_label = "&OK" cancel_button_label = "&Cancel" varC_result = ui_dlg_box("Date Range Selector",<<%dlg% {region} Start Date:| [%DATE;P=popup.calendar(dtoc(vd_first_date));I=popup.calendar%.40vd_first_date!vd_first_date_*]; Last Date:| [%DATE;P=popup.calendar(dtoc(vd_last_date));I=popup.calendar%.40vd_last_date!vd_last_date_*]; {endregion}; {line=1,0}; {region} <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL> {endregion}; %dlg%,<<%code% if left(a_dlg_button,14) = "vd_first_date_" then if a_dlg_button = "vd_first_date_killfocus" then vd_first_date = ctod(dtoc(vd_first_date)) end if a_dlg_button = "" end if if left(a_dlg_button,13) = "vd_last_date_" then if a_dlg_button = "vd_last_date_killfocus" then vd_last_date = ctod(dtoc(vd_last_date)) end if a_dlg_button = "" end if %code%)
It seems the SQL must be without double quotes, which is what you get when converting with DTOC(vd_first_date,"1/")
Is there a function to substitute the double quotes for single quotes?
eg WHERE APPLICATION_DATE BETWEEN :vd_first_date AND :vd_last_date
Comment