Hey
Using your latest build of dotConnect for mySQL.
I have two date fields, which allow NULL values.
I have bound my fields with a bindingsource to the controls.
I found out, that after calling bindingsource.endedit the datacontext is filled correct (datacontext.table.field = Nothing)
After calling datacontext.submitchanges the date field got the value:
datacontext.table.field = #12:00:00 AM#
Please check this out. - THX
DataContext Problem
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Could you please describe the situation in more details? I.e., what controls you are using, how exactly you bind DataContext to these controls, and what changes you perform before executing SubmitChanges? If possible, please send us a small sample with which the issue can be reproduced.
Hey
I can't send you a test example at the moment. - Maybe we get it working this way:
Just try the following, it should reproduce the problem.
Create a mysql Date field, allowed to save NULL
Then try the following code (I do it out of my mind, don't having my PC here)
Please try to reproduce
THX
I can't send you a test example at the moment. - Maybe we get it working this way:
Just try the following, it should reproduce the problem.
Create a mysql Date field, allowed to save NULL
Then try the following code (I do it out of my mind, don't having my PC here)
Code: Select all
Dim myContext As New DataContext
Dim TryIt = (From Query In myDatacontext.Sample).SingleOrDefault
TryIt.Datefield = Nothing
-- HERE CHECK THE VALUE OF Datefield
myDataContext.SubmitChanges
-- ReCheck the Value of Datefield. - Now it got's the value, I described in my first post
THX
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
I've tried to reproduce the problem with the following table and failed:
Could you please specify the following:
- the version of dotConnect for MySQL you are using;
- the version of the MySQL server;
- if you are using a Date or DateTime MySQL field;
- whether the Date field was empty or contained a value when assigning Nothing to it;
- whether you are able to reproduce the problem when just calling the SubmitChanges method or if it occurs when using BindingSource only.
Code: Select all
CREATE TABLE IF NOT EXISTS sample
(
id INT(11) NOT NULL DEFAULT 0,
datefield DATETIME DEFAULT NULL,
PRIMARY KEY (id)
)
- the version of dotConnect for MySQL you are using;
- the version of the MySQL server;
- if you are using a Date or DateTime MySQL field;
- whether the Date field was empty or contained a value when assigning Nothing to it;
- whether you are able to reproduce the problem when just calling the SubmitChanges method or if it occurs when using BindingSource only.