Problem with query date parameters

Stimulsoft Reports.WPF discussion
LSantos
Posts: 9
Joined: Thu Aug 16, 2012 8:30 am

Problem with query date parameters

Post by LSantos »

Hello comunity

I have download you demo prduct to try.
I build a simple query , like this:
select dbo.ml.data, dbo.ml.conta, dbo.ml.debit, dbo.ml.credit from dbo.ml where
dbo.ml.data between @Datestart and @dateEnd

When i run this query, i fill my Datestart and Dataend on the calendar, but the query rerun always the same error:
Statement(s) could not be prepared.
Must declare the scalar variable "@DateStart".

I see your video on "http://www.stimulsoft.com/livedemos/par ... rt_1).html", and i follow exactly the same process step-by-step.

What are fail ???
Many thanks
Luis Santos
LSantos
Posts: 9
Joined: Thu Aug 16, 2012 8:30 am

Re: Problem with query date parameters

Post by LSantos »

Hello again

I change the connection to my SQL server to : SQL.Connection.
My query now work with the code i send and return the correct values between dates, the only thing that´s not appear is to 2 calendars to sleect the dates, only a pop-up to introduce the variables, but when i ask the report preview another error appear:
Failed to convert parameter value from a DateTimeRange to a DateTime.

Someone could help me!
Best regards
Luis Santos
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

Re: Problem with query date parameters

Post by Ivan »

Hello,

Can you please send us a sample report template with data or a simple test project, which reproduces the issue?

Thank you.
LSantos
Posts: 9
Joined: Thu Aug 16, 2012 8:30 am

Re: Problem with query date parameters

Post by LSantos »

Hello Ivan

How can create the report template or a simple test project?
I can send you a script to create sql table with some data, and also the report save in mrt file.
also, how can send you in this forum a zip attachement file ?

Best regards
Luis Santos
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Problem with query date parameters

Post by HighAley »

Hello.
LSantos wrote:I can send you a script to create sql table with some data, and also the report save in mrt file.
also, how can send you in this forum a zip attachement file ?
It will be enough.
You could add files to your message at the Upload attachment tab under editor window.
attach.png
attach.png (12.12 KiB) Viewed 4354 times
Thank you.
LSantos
Posts: 9
Joined: Thu Aug 16, 2012 8:30 am

Re: Problem with query date parameters

Post by LSantos »

Hello Aleksey and Ivan

I send to you the script to create the SQL Table and also the Script to INSERT several records for testing (Both in on TXT file).
I send also my Report save as .mrt file.
All this things are on zip file attachment.

I hope you can give me some help.

Best regards
Luis Santos
Attachments
Stimulsoft.zip
report and script to create table and Insert records for testing
(57.03 KiB) Downloaded 270 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Problem with query date parameters

Post by Alex K. »

Hello,

Can you please check the sent script. We get the following error:
"There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement."

Thank you.
LSantos
Posts: 9
Joined: Thu Aug 16, 2012 8:30 am

Re: Problem with query date parameters

Post by LSantos »

Hello Aleksey

Sorry about the script for inserting records on table ML, the error is due to the decimal separator is set to "," and not ".".
Now i correct the problem and i send you just the correct script.

Many thanks
Luis Santos
Attachments
New Script to insert records on table ML.zip
New INSERTING Script for table ML
(54.1 KiB) Downloaded 265 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Problem with query date parameters

Post by Alex K. »

Hello,

Please check the modified report in attachment.

Thank you.
Attachments
TEST_Report between 2 variable date_modified.mrt
(8.76 KiB) Downloaded 620 times
LSantos
Posts: 9
Joined: Thu Aug 16, 2012 8:30 am

Re: Problem with query date parameters

Post by LSantos »

Hello Aleksey

Thanks for your reply, i will test the report that you send me.

Many thanks
Luis Santos
Post Reply