?
Solved

RDLC REPORT WITH PARAMETERS

Posted on 2009-12-28
11
Medium Priority
?
1,152 Views
Last Modified: 2012-05-08
I am using winforms on Visual Studio 2008, I have a report rdlc which get the data from a dataset
using the following query
SELECT     LABEL, SELLBY, PRICE, TARE, PLU, CODE, DATE
FROM         BIZERBA
GROUP BY LABEL, SELLBY, PRICE, TARE, PLU, CODE, DATE
HAVING      (DATE = ?)

I want to have a textbox on the form which I want to type the Date on the following format
12/24/2009 or any other date  then use this value for the report as a parameter based on the DATE field
I know I need to declare this under the form load, but I am having the difficulty doing this. Any code samples will be help . Thanks
0
Comment
Question by:teogos
  • 7
  • 4
11 Comments
 
LVL 9

Expert Comment

by:Stephan_Schrandt
ID: 26131470
I assume you use a tableadapter to fill the dataset. Open the dataset, choose the tableadapter, choose SelectCommand in properties window and add a parameter called Date. Then your fill method of the tableadapter will be extended and you can pass the parameter as argument like this:

Me.YourTableAdapter.Fill(Me.YourDataSet.tblYourTable, Convert.ToDateTime(YourTextbox.Text)
0
 

Author Comment

by:teogos
ID: 26131549
I can see the parameter DATE when I go into the table adapter, but I can not see the fill extended for the FILL  and where Do I put the argument ?
0
 
LVL 9

Expert Comment

by:Stephan_Schrandt
ID: 26131578
Somewhere there's a line in your code like this:

Me.YourTableAdapter.Fill(Me.YourDataSet.tblYourTable)

When you add the parameter Date to the SELECTCOMMAND of tableadapter, the method above accepts one more parameter:

Me.YourTableAdapter.Fill(Me.YourDataSet.tblYourTable, Convert.ToDateTime(YourTextbox.Text,YourDate)

To be more specific, please post part of the code that fills the dataset (or whole code). Be sure to save the dataset before trying to extend the method.


0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:teogos
ID: 26131615
Here is the code I have on a Bottom Click event but nothing brings on the report
Me.BIZERBATableAdapter.Fill(Me.DataSet1.BIZERBA, Convert.ToDateTime(TextBox1.Text))


0
 

Author Comment

by:teogos
ID: 26131777
If I put this code on the form load or reportviewer load
is gaves me the error
"string was not recognized as a valid date time"
0
 
LVL 9

Expert Comment

by:Stephan_Schrandt
ID: 26131829
That's because your regional settings do not accept 12/24/2009 as a date. Try 24/12/2009 instead. For further actions I would recommend the datetimepicker.
0
 

Author Comment

by:teogos
ID: 26131867
No neither one of the choices, gave me records, either by putting 24/12/2009  or using a datepicker, when I preview the table the records show 12/24/2009
0
 
LVL 9

Accepted Solution

by:
Stephan_Schrandt earned 2000 total points
ID: 26131978
Do both solutions still raise the error "string was not recognized as a valid date time"?
0
 

Author Comment

by:teogos
ID: 26131999
Only when I put the code on the form load or reportviewer    load  events
0
 

Author Comment

by:teogos
ID: 26132046
I got it, during this whole process I have another parameter into the report itself. by removing this work fine, but Also I have to do
Me,Reportviewer1.refreshreport()
0
 

Author Closing Comment

by:teogos
ID: 31670386
Thanks
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Integration Management Part 2

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question