on 11-13-2007 1:26 PM
Good Day
Experts:
I am having all kind of trouble trying to figure out how to save a blank Datetime datasource defined field to a SQL Server 2005 database field defined as Datetime.
When adding a record to one of our AddOn screens, several fields defined as Datetime datasource and Datetime in the database are not required to have any data(valid date) in them. Here is what I have tried using:
WOForm.Items.Item("txtCompDte").Specific.value
WOForm.DataSources.UserDataSources.Item("u_DemDue").ValueEx
The variable declared at the top of my S/P that I am calling is defined as datetime since the target field is defined as datetime.
How do I pass the data or potentially lack of data to this datetime field so I don't end up with 1/1/1900 in the table? This creates a problem since then 1/1/1900 is then shown back on the screen instead of a blank field.
Thanks for the help,
Ed
Ed,
Basically the system will take the date as year-mm-dd. So u have to convert it. You better to try
datetime.parseexact(WOForm.DataSources.UserDataSources.Item("u_DemDue").ValueEx,"yyyyMMdd", Nothing)
If it helps give reward points,
Regards,
Anitha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ed,
While Inserting a Empty datetime value Check for the Empty Datetime if it is empty then pass Null value to that field.While Retrieving the datetime value Check For that null using isnull function of SQL server if it is null then Assign empty value for that field
SELECT isnull(URDATETIMEFIELD,'') FROM TABLE1.
Hope this helps
Regards
Vishnu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.