-
Jun 3rd, 2022, 01:32 AM
#1
Thread Starter
Lively Member
Datepicker editing in WPF datagrid with MSAccess .mdb database
Dear Guys,
I have been developing a wpf application with a MS Access .mdb database. The pain window includes a range of textboxes from large data table, with 3 child tables to the main table, all as datagrids on the main window. I have had difficulties with the textboxes accepting null values, and this has been resolved for text formats by specifying acceptance of null values within the Access database. However, Access only allows this setting for text fields, not date fields.
When I try to enter date values or changes in date fields (currently all datepickers), I cannot update the field using update functions, with a null exception thrown. I can work around this by placing the field in edit mode by double clocking or F2, and then exiting by tab once the data are added. However, this is clumsy. Does anyone have any thoughts on how this might be done more elegantly. eg is there code to emulate F2? I cant find it anywhere?
Thanks again.
-
Jun 3rd, 2022, 01:40 AM
#2
Re: Datepicker editing in WPF datagrid with MSAccess .mdb database
Originally Posted by Bear89
Access only allows this setting for text fields, not date fields.
That's simply not true. I'm not aware of any database that doesn't allow nulls in all columns regardless of data type, including Access. I just tested by creating a new Access database and added a Date/Time column to the default table and, sure enough, in design view I was able to specify Yes or No for Required. Not required, which was the default, means nullable.
-
Jun 3rd, 2022, 01:45 AM
#3
Thread Starter
Lively Member
Re: Datepicker editing in WPF datagrid with MSAccess .mdb database
OK thanks jm, I have checked the parent Access setting and it is set to No for the Date:Required field.
-
Jun 3rd, 2022, 02:43 AM
#4
Re: Datepicker editing in WPF datagrid with MSAccess .mdb database
That means that saving NULL values to the database is not the issue, so you need to determine what is. Looking closely at the exception and its stack trace would be the place to start with that.
-
Jun 3rd, 2022, 02:52 AM
#5
Thread Starter
Lively Member
Re: Datepicker editing in WPF datagrid with MSAccess .mdb database
Thanks Jm, at the moment no exception is being thrown, and I have tried a number of options but nothing is thrown. But the data of the row in question are simply not updated to the database when a change to the datepicker field is made. Does the fact that it can be resolved by F2-tab throw any light?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|