I am creating a Lookup for a form where 2 of the parameters are dates sent to VARCHAR() datatypes in a SQL Server Database. I've tried to use Date Fields to obtain the dates but these do not work. I then added 2 Single Line fields and set those as the parameters for the query. When I type the date into these Single Line fields the query works just fine. So I then thought maybe clicking in the textbox, typing the date, and tabbing/clicking out (moving focus) triggers an event so I set the Lookup Rule back to the Date fields and tried to type in the dates instead of using the calendar but it still did not work. I seems as though the Date field is not passing a string to the stored procedure but rather something else.
Question
Question
Replies
Maybe you can try a wrapper SP1 of your current stored procedure SP2. In SP1, you take in the Date parameters and convert the date to string, using the strings as parameters to call SP2 in SP1.
You can use for example,
SELECT CONVERT(varchar, @datetimeVar, 21)
to convert the Datetime type to varchar.
21 is the style code for datetime, you can search it online for different ones.
My SPROC works as is. I can execute the stored procedure in SSMS and it works. In my SPROC both date parameters are VARCHARs and I convert them into DATE when using them in the WHERE clause. Since the Lookup in the form works with a simple Single Line field type and not with a Date field type then I assume it's the way Laserfiche forms is passing the data from the Date field type.