.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

ASP.Net / ODP.Net setting null date

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
Using VS2008, c# and ODP.Net(   In the following procedure  a_end_date  may or may not be null. If the input string is null, I tried to set  a_end_date to null. It is giving error.  The same result if I try to set it to dbNull.   How do I set null to a date field   Thanks Suresh   public string InsertOnlineApplication( string a_start_date,                                           string a_end_date,                                           string a_status,                                           string a_app_type) {              OracleGlobalization info = OracleGlobalization.GetClientInfo();            &nbs

View Complete Post

More Related Resource Links

Updating a List item field value in a SPD Workflow is setting Date fields to null

Hello everybody,I faced a very weird behavior while creating a workflow in SPD against a Document Library.Here is the case:1- Create a document library in sharepoint site.2- Add a custom column of type DATE.3- Upload any document to the library4- Edit the item metadata and set the custom date field to any date you want.5- Now using sharepoint designer, create a very simple Workflow with only one action that updates the current item "Title" field to any value. (Note: In my case I set the workflow to start manually and not automatically)6- Save the workflow and then start it on the uploaded item.7- Now check the value of the date column after the workflow is finished.8- You will see that the Date field is Empty... (very weird)Notes:   1-This behavior will not appear on a standard list. it is only appearing in a Document library.  2- I am using WSS 3.0 SP2 + MOSS 2007 SP2. Also SharePoint designer 2007 SP2Did anyone face this situation and does it have a fix, or am I doing something wrong here... Please help.Regards,Maheed

Not Null Date Default

I'm one of the people that try to avoid nulls when ever possible, usually using defaults.  This is especially important since my apps do a lot of data exchange with external entities often involving flat files.  A flat file can't distinguish between a null or an empty value so to ensure consistancy between data types in both systems I try to make sure every field has some value.  (E.g., If I have a null or empty string in a char field type a CSV flatfile shows ',,' for both.  The target system might interpret this as an empty string or a null; I have no direct control.  This could result in a null in one system and '' in another losing consistancy.  For charactor and number types this is rarely a problem if I communicate that there are no null fields in the data, but for dates it often becomes an issue. Is there a industry standard approach to managing "empty dates" so I can make date fields not null and empty? Thanks

how to force null in date field - access 2007 ?

hi i have table that contain date field. how i can force null or empty value on this field ? thank's in advance

Setting a date time field to now


Hi all

MOSS 2007 - Visual Studio Sequantial Workflow.

I have a field in an item that I want to update within my Workflow code.

Field Definition:

<Field Type="DateTime" DisplayName="Date Approved/Declined" Required="FALSE" Format="DateOnly" ID="{0c1d9bb7-52f9-4b83-8d26-eda6c9879921}" SourceID=

_events is null or not an object only after setting compile debug="false"



I have been running an application in debug mode for awhile, and am ready to launch it to production.  The application which uses ASP.Net AJAX controls pretty heavily, works fine when the Web.Config value is:

<compilation debug="true">

However, once I change the value to:

<compilation debug="false">

The application starts throwing errors whenever I click on something that would fire an AJAX update event in my application.  The error is:

Webpage error details

Message: '_events' is null or not an object
Line: 5
Char: 36005

As soon as I set debug="true" again, everything works as it should.

Any ideas?

setting system date format...........

Hello everybody,
I m working on a windows application in VS2005. I want that when this application run, it changes the system date format in MM/dd/yyyy, bcs this application will not work correctly when the system format is other than this format.
              Can anyone tell me how can i set the system date format programatically in C#? Pls its urgent...........

Problem inserting a null value into date column in SQL table


Hi all,

I am having a hard time inserting a null date into a SQL table.  Please be aware that I am using the Microsoft Application Data Blocks and not pure ADO.net.  I find a million examples of how to do this with ADO.net but cannot find anything about this using the MS Data Application Blocks.

Here is my VB.net code:

Save(Session("ref_no"),  txtdischarge_date.Text) 

Sub Save(ByVal ref_no As Integer, discharge_date As Date)

        SqlHelper.ExecuteNonQuery(connString, ref_no, discharge_date), "MyTableInsert")

End Sub

The textbox txtdischarge_date can either be a valid date or blank.  If it contains a valid date then the insert works properly.  But if the textbox  is blank, then I want to insert a null value into my date column.  I cannot get this to work.  I get this error when I run this and txtdischarge_date is blank:

Conversion from string "" to type 'Date' is not valid

Here is the code for my stored procedure, MyTableInsert:

ALTER Procedure MyTableInsert
   (@ref_no int,
    @discharge_date datetime = NULL)

Active Service Requests based on start and end date, where date is null or in range



I have FACT and DATE dimension

ServiceRequestFactID          StartDateId           EndDateId

100              20090401              20090501
101              20090501              NULL
102              20100301              20090401

       DateID              FYear     FQuarter     FPeriod
       20080401          2009        Q1            01
       20080429          2009        Q1            02


Some service requests do not have end date, which means that they have service request all the time.

Date Hierarchy:   FYear -> FQuarter -> FPeriod. (Note: the hierarchy is not till the date level)


MDX Help: How to calculate the acti

Testing for Valid Date or Null Value -- Using Conditional Split


I have a Flat File Source with several columns of data that should be valid dates.  Sometimes however they may either be NULL or not valid dates.  I understand the expresstion ISNULL([ColumnName]) will test for the NULL condition.  What is the syntax to test if the value is a valid date?  It might be a string such as "baddate" or it could be a date that is too old.  Could you provide an example of an expression that will test for both of these conditions?




Problem in setting calendar selected date


I am using the fallowing code to set the selected date of calendar control to one day previous of the current date, but still the calendar is showing the current date as the selected date.

Calendar1.SelectedDate =


can anyone help me regarding this issue.

SSAS 2008 - Date Member Property gets converted from NULL to (Blank)


Hello everyone,

I have this cube with a dimension of investment deals.  The "Deal" member has a attribute named "Latest Acquisition Date" where this date can be null for some deals.  Once the cube is processed, the null dates always get converted to "(blank)" either in BIDS cube browser or in Excel.  This happens no matter what I do to the NullProcessing property of this date attribute.

Is there any way to have SSAS display [NULL] (as in nothing at all) instead of "(blank)" ?

If a date is null or doesn't exist return another date



I have 2 dates which are calculated members:

SELECT ReportingMonday ON 0
FROM DataCube

SELECT [FirstCubeDate] ON 0
FROM DataCube

ReportingMonday= StrToSet("[Dim Date].[Date Key].&[" + IIF(WEEKDAY(NOW())<=2,FORMAT(DATEADD("W",-5-Weekday(NOW()),CDATE(Now())),"yyyyMMdd"),FORMAT(DATEADD("W",2-Weekday(NOW()),CDATE(Now())),"yyyyMMdd")) + "]")

FirstCubeDate = HEAD([Dim Date].[Date Key].[Date Key].Members,1)

What I want is a named set to say:

if ReportingMondayis null or blank (so there isn't a report monday e.g. the data started on Tuesday) then return FirstCubeDate

Any Ideas?




Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

jQuery Date picker Implementation in ASP.NET

I've posted a wrapper ASP.NET around the jQuery.UI Datepickercontrol. This small client side calendar control is compact, looks nice and is very easy to use and I've added it some time back to my control library.

This is primarily an update for the jQuery.ui version, and so I spend a few hours or so cleaning it up which wasn't as easy as it could have been since the API has changed quite drastically from Marc's original implementation. The biggest changes have to do with the theming integration and the resulting explosion of related resources.

If you want to use this component you can check it out a sample and the code here:

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend