DataContext Problem

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

DataContext Problem

Post by Zero-G. » Sun 12 Sep 2010 11:42

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

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Mon 13 Sep 2010 15:05

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.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Post by Zero-G. » Wed 15 Sep 2010 13:53

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)

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
Please try to reproduce

THX

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 16 Sep 2010 15:03

I've tried to reproduce the problem with the following table and failed:

Code: Select all

CREATE TABLE IF NOT EXISTS sample
(
  id INT(11) NOT NULL DEFAULT 0,
  datefield DATETIME DEFAULT NULL,
  PRIMARY KEY (id)
)
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.

Post Reply