473,761 Members | 6,563 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Set Parameters(..) 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 10156
Hello,

The method LocalReport.Set Parameters(..) 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.setparam eters(VS.80).as px

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.ToSt ring() 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.ToStri ng() 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
1530
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 //The next line breaks: Error: Method name expected
2
23792
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. It seems that dates aren't recognized. I tried using several date formats, for example, dd/mm/yyyy, mm/dd/yyyy, yyyy/mm/dd, and so on, without success. Any help woud be greatly appreciated,
0
1489
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 is with Windows Applicaiton. How to print LocalReport with WebApplication?
2
1952
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 needs to pass a Date data-type that is empty much like a string would be empty if we were to place double quotes as in "". The reason it needs to be empty is because I am passing parameters to a
4
7252
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 - "Modified" of type DateTime - is hidden since it should not be edited by a user. The system handles the update for this column. So, I have hidden (Visible=false) this column on the grid. In order to access the value in this field, I have created a...
3
3695
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 Excel and PDF format. To do this I am using the LocalReport object the Microsoft.ReportViewer.WinForms namespace. This is all running in a web-based service running in IIS. In development and UAT this has worked flawlessly and had been very...
1
1169
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. CREATE PROCEDURE . -- Add the parameters for the stored procedure here @starttime DateTime AS BEGIN
0
1339
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" Inherits="Report_Report" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
0
1929
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
9522
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9948
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3866
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.