Showing posts with label basic. Show all posts
Showing posts with label basic. Show all posts

Tuesday, March 27, 2012

Date Query Parameter

Hi There,

I've only just starting working with RSS2005. I've started designing basic reports that pulls info from our HEAT DB (incident/change logging system).

One of the report requirements is to be able to pull reports for calls that were logged for specific day/date, using the calllog.recvddate field in the HEAT DB.

What i would like to know is how do i do this ? i.e. how do i setup the date query parameter so that the user can select a date from the calender picker that returns all calls logged for the selected date ? How do i link the date parameter to the calllog.recdvddate field ?

Thanks,

RSS2005 NOOB

Hello,

Here's what you need to do.

Select 'Report Parameters' from the Report menu. Click 'Add', give the parameter a name (ex. DateParam), change the data type to 'DateTime', and hit OK. Go to your query from the Data view, and in your where clause, add calllog.recvddate = @.DateParam. If your recvddate has the time stored as well, you'll need to add this instead: convert(varchar, calllog.recvddate, 101) = @.DateParam.

Now when you preview your report, you will see a parameter section at the top of your report, pick your date and select 'View Report'.

Hope this helps.

Jarret

|||

Thanks so much for the Reply Jarret, i tried what u said and it apprears to work. The call totals correspond to those in the DB .... UBBER YAY !!!!!

Can't believe how close i was yet so far at the same time !

Friday, February 24, 2012

Date field cannot be null!

Visual Basic 2005 Professional Edition:

I have an SQL database table that includes a BirthDate field. I would like to have this field as optional when adding a record, but, SQL insists on throwing an exception if the field is null.

With this it looks like your table design has the field set not to allow nulls. You will have to alter the table definition to allow nulls for that field. This can be done in raw tsql, or using the table design views in either of the management studio tools.

|||

I went into DataSetDesigner and in Properties I set AllowDbNull to True.

But, when I tried to change the NullValue property from "Throw Exception" to "Empty" or "Nothing" (there are only 3 choices) it said "For columns not defined as System.String, the only valid value is (Throw exception)".

|||

Given that you've just allowed nulls, the value of the NullValue property is irrelevant, as the exception should never be raised.

|||

The following exception occurred in the DataGridView:

System.Data.NoNullAllowedException: Column 'BirthDate' does not allow nulls

I set 'AllowDbNull' to True in the properties field of the DataSet Designer, replied 'Yes' to 'Save Changes', but, when I go back in, 'AllowDbNull' is back to False.

|||

ok - I've done some research on this (I'm a SQL guy, not a VS guy) and it looks like there may be a bug in the Dataset Designer for non-string columns. I found what looks like a workaround here: http://www.codeproject.com/useritems/Bug_fixed_in_DataDesigner.asp

Hope this helps