.net - Crystal reports Command for date Range in Visual Studio 2012 -


i editing application made in visual studio 2012. trying create crystal report user selects date range. added command simple sql server query, runs fine in sql management studio.

select customerid, orderid, orderdate tblorders orderdate between convert(datetime, '01/01/2015 00:00:00', 102)                      , convert(datetime, '01/01/2016 11:59:59', 102) 

i created parameters , dates , substituted dates:

select customerid, orderid, orderdate tblorders orderdate between convert(datetime, '{?from} 00:00:00', 102)                          ,                              convert(datetime, '{?to} 11:59:59', 102) 

i following error using same dates:

failed retrieve data database. details: ado error code 0x80040e14 source microsoft ole db provider sql server description: incorrect syntax near '2015'. sql state: 42000 native error: 102 [database vendor code 102] 

i tried query without convert function, same result.

this not correct code:

'{?from} 00:00:00' 

it can be:

{?from}  & " " & '00:00:00' in formula 

and wondering why want parameter static time?

this convertion running tested.

convert(datetime,convert(datetime, convert(varchar,dt,101) + ' 00:00:00',102), 102)  

you can change dt {?from} in crystal report


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -