473,289 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

problems updating a date type

Hello,

I'm using VWD 2005 and have a grid on the page. In that grid, there's
a column that is of date/time type. Nulls are allowed in this column.
I'm having problems when trying to edit this date column.

I've converted the column to a template and changed the
EditItemTemplate from a textbox to a calendar. If a date previously
existed for the record being edited, the update action works. If the
date was previously NULL and then a date is chosen via the calendar
control, this error is thrown:

Server Error in '/Names' Application.
________________________________________
Conversion from type 'DBNull' to type 'Date' is not valid.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Conversion from type
'DBNull' to type 'Date' is not valid.

I've seen lot of solutions in my research where code fixes this. I'd
prefer to leverage the capabilities the development environment gives
me and solve it that way. Is there a property or a configuration I've
missed somewhere?

Thanks!

May 11 '06 #1
2 1220
DWS
Adam,
you must be kidding I did not know you could do that. I'd try low value
date and treating it like a null.

DWS
"Adam Sandler" wrote:
Hello,

I'm using VWD 2005 and have a grid on the page. In that grid, there's
a column that is of date/time type. Nulls are allowed in this column.
I'm having problems when trying to edit this date column.

I've converted the column to a template and changed the
EditItemTemplate from a textbox to a calendar. If a date previously
existed for the record being edited, the update action works. If the
date was previously NULL and then a date is chosen via the calendar
control, this error is thrown:

Server Error in '/Names' Application.
________________________________________
Conversion from type 'DBNull' to type 'Date' is not valid.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Conversion from type
'DBNull' to type 'Date' is not valid.

I've seen lot of solutions in my research where code fixes this. I'd
prefer to leverage the capabilities the development environment gives
me and solve it that way. Is there a property or a configuration I've
missed somewhere?

Thanks!

May 14 '06 #2

DWS wrote:
Adam,
you must be kidding I did not know you could do that. I'd try low value
date and treating it like a null.

DWS


Nope... if the record is null then VS gives me the finger because it
doesn't know how to convert how to convert a null to a date. With a
textbox, there's no problem but with the calendar control; it's not
happy.

I was hoping there was something in the properties window, which I may
have overlooked, to keep this error from being thrown... but I guess
there's not. I ended up using a code behind solution.

May 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: | last post by:
Hello, Sorry to ask what is probably a simple answer, but I am having problems updating a table/database from a PHP/ PHTML file. I can Read From the Table, I can Insert into Table/Database, But...
2
by: m | last post by:
hi all, got an interesting problem: im working with purchase orders and in detail line i have a date field. so for example: header line: PO code: X123 PO value: ...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
18
JamesDC
by: JamesDC | last post by:
Hi, So I'm working with an Access 2002 database for waste managemnt. The person in my role before my put together the program before he left and now I'm in charge of it. After updating a few...
4
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I setup a simple gridview as a utility just to do some updates, nothing fancy just wanted easy UI to make updates. When I select ‘Edit’, I get the fields I want to edit. I edit them and click...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
9
by: Marianne160 | last post by:
Hi, I know there are various answers to this problem available on the web but none of them seem to work for me. I am using Access 2003 to make a form to look up data from a table. I have so far...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.