Last post Sep 22, 2010 12:58 AM by Suresn
Member
20 Points
115 Posts
Sep 17, 2010 03:06 AM|Suresn|LINK
Using VS2008, c# and ODP.Net(2.111.7.20)
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();
if (a_end_date == "") { a_end_date = null; }
OracleDate a_start_date_in = new OracleDate(a_start_date);
OracleDate a_end_date_in = new OracleDate(a_end_date);
info.DateFormat = "DD-MON-YYYY";
OracleGlobalization.SetThreadInfo(info);
if (a_end_date == "")
a_end_date = null;
}
Contributor
3422 Points
1335 Posts
Sep 17, 2010 05:18 PM|Lannie|LINK
And the error message details are?
Sep 22, 2010 12:58 AM|Suresn|LINK
Problem Solved
Member
20 Points
115 Posts
ASP.Net / ODP.Net setting null date
Sep 17, 2010 03:06 AM|Suresn|LINK
Using VS2008, c# and ODP.Net(2.111.7.20)
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();
if (a_end_date == "") { a_end_date = null; }
OracleDate a_start_date_in = new OracleDate(a_start_date);
OracleDate a_end_date_in = new OracleDate(a_end_date);
info.DateFormat = "DD-MON-YYYY";
OracleGlobalization.SetThreadInfo(info);
if (a_end_date == "")
{
a_end_date = null;
}
}
Contributor
3422 Points
1335 Posts
ASP.Net / ODP.Net setting null date
Sep 17, 2010 05:18 PM|Lannie|LINK
And the error message details are?
Member
20 Points
115 Posts
Re: ASP.Net / ODP.Net setting null date
Sep 22, 2010 12:58 AM|Suresn|LINK
Problem Solved