Reputation: 4702
Heres the issue.
I have a table(mySQL) that contains dates and some of them are null. I know that I can use DateTime? or Nullable to allow nulls, but I'm not sure where to set it.
What I've tried:
I built the class in the dblm. The date propery has the following attributes set:
Nullable : True
Server Data Type : DateTime
Type : NUllable<DateTime>
These settings allow my code to be built. When I debug it a get this exception thrown: System.NullReferenceException: Object reference not set to an instance of an object..
If I try to with these attributes:
Nullable : True
Server Data Type : NUllable<DateTime>
Type : NUllable<DateTime>
I get the same exception as above.
Other ways that did not work:
Nullable : True
Server Data Type : DateTime?
Type : NUllable<DateTime>
Nullable : True
Server Data Type : DateTime?
Type : DateTime?
I'm using .net's 3.5 Framework
Thanks
Upvotes: 0
Views: 932
Reputation: 4702
Fixed - It turned out to be an issue with the connection string to connect to the mySQL DB.
Also I didn't know that it was possible to drop a table into the DBML using the Server Explorer. All I needed to do was connect to the database then drop the table onto the DBML.
Upvotes: 0
Reputation: 22310
I remember a problem with mysql's ADO.NET driver, where it was not playing nice with nulled date/time fields at all.
Even IsDBNull was throwing exception on a field with null date/time.
It may be still an issue.
Upvotes: 1