473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Pass DateTime parameter to LocalReport?

I'm able to pass string parameters with no problems to a LocalReport being
displayed by the ASP.NET ReportViewer control. However, my report also has
a DateTime parameter. LocalReport.SetParameters(..) only seems to allow me
to set string parameters. Is there a way to pass DateTime (or other types)
of parameters? Or can I only use string parameters in a LocalReport if I
need to pass them in from my ASP.NET app?

Thanks,
cpnet
Jan 31 '07 #1
5 10128
Hello,

The method LocalReport.SetParameters(..) can accept ReportParameter object
as its parameters. However, ReportParameter can only be initialized with
string value. So, we can only pass string to SetParameters(..) method.
Regarding the issue, can you change the required parameter for the report
to string value, for example a string with datatime value like '1/1/2007'?
Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 31 '07 #2
That's what I had to do to get it working. But it means I also have to
change the LocalReport parameters to the string type. And that means a lot
of extra type conversions if I want to use such parameters as actual dates
in the report.
Jan 31 '07 #3
Hello,

I don't think we have to change the actual parameter in the report. For
example, we have a parameter named "CurDate" in the report, and its data
type is "DateTime", we can pass a string value like '1/1/2007' to it
directly with SetParameters. Here is the document for SetParameters:

http://msdn2.microsoft.com/en-us/lib...informs.server
report.setparameters(VS.80).aspx

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 1 '07 #4
I understand that I can convert a DateTime to a string, pass it to the
report in a ReportParameter as a string, then use it in the report. But if
I want to use some date functions in the report (like DateDiff, DateAdd)
etc., then I have to convert that string back to a DateTime in the Report
before using those report functions. It would be a lot more efficient to be
able to pass it in as a DateTime.

A LocalReport supports DateTime parameters, unfortunately as far as I can
tell, ReportParameter can only be used to set LocalReport parameters of type
string (which is a real limitation in my opinion).

When I tried to pass in MyDateTime.ToString() to a DateTime parameter, I got
errors. I was only able to pass in string values to String parameters.
Maybe my problem is that DateTime.ToString() formats the DateTime value
incorrectly, but I doubt this was the case because this was all running on
the same machine which should have consistent regional settings. I suspect
that I can in fact only assign values for string parameters. Even if the
reason for my errors was that I wasn't formatting my date string properly,
that just exposes another problem with using strings instead of other
types - you always have to worry about how you're formatting your strings so
that they can be converted back to the relevant type at the report's side of
things.

So, I guess this should go on the feature request list for the next .NET?
Feb 2 '07 #5
Hello,

If you consider this is necessary feature, I suggest you may submit a
feedback on this page:

http://connect.microsoft.com/site/si...spx?SiteID=210

Our dev team will collect all the feedback and bring them to consideration
for next release.

Sincerely,

Luke Zhang

Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Feb 2 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: xzzy | last post by:
I need to update the .Text of a label until the user logs out. but get this error: Error: Method name expected I have listed the code below and the offending line of code is delimited by ...
2
by: Jaime Stuardo | last post by:
Hi all.. I have a WebMethod with a parameter defined as DateTime. When I call that webservice, I get this error: System.FormatException: The string '07/24/2005' is not a valid AllXsd value. ...
0
by: ad | last post by:
Hi, There is no print button when use LocalReport with WebApplicaiton. The article http://forums.microsoft.com/msdn/showpost.aspx?postid=22277&siteid=1 Show us how to print with program, but it...
2
by: glenn | last post by:
Hi folks, I guess this question has to do with formatting dates. Seems like it should be a no brainer but have spent too much time hunting so I am posting the forum. I have a function that...
4
by: =?Utf-8?B?QmFidU1hbg==?= | last post by:
Hi, I have a GridView and a SqlDataSource controls on a page. The SqlDataSource object uses stored procedures to do the CRUD operations. The DataSource has three columns one of which -...
3
by: Oenone | last post by:
Sorry for the cross-post, but I'm not sure what the best place to post this is, and I'm getting a bit desparate. Part of our product uses the SQL Server Reporting engine to create reports in...
1
by: bbawa1 | last post by:
I have the following Stored procedure. There is column named "tcktreceived" in my database and I want to pass all the rows one by one to the parameter @starttime. I don't know how to do it. ...
0
by: trini32 | last post by:
and another problem which just wont work as I planned.. I created an aspx site (report) as follows: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Report.aspx.cs"...
0
by: umalingesh | last post by:
Hi, I have a .Net webservice which takes a Datetime object as parameter public string GetDateTime(DateTime dt) { return dt.ToString(); }
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.