2

I'm getting a MySqlConnectionException when i'm trying to connect retrieve data from my DBContext class because i have a date time entry line 0000-00-00 00:00:00.

From what i understand i have to add a Allow Zero Datetime=true entry in my connection string, the one bellow.

<add name="A4LifeEntities" connectionString="metadata=res://*/A4LifeEntities.csdl|res://*/A4LifeEntities.ssdl|res://*/A4LifeEntities.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;password=pass;user id=userId;port=3330;Allow Zero Datetime=true; persist security info=True;database=aLife&quot;" providerName="System.Data.EntityClient"/></connectionStrings>

As you can see i have already added it, but am i doing something wrong ? Do i have to add it somewhere else in the string ? Because it's not working.

Thank you

1
  • 1
    See this Commented Mar 30, 2013 at 21:18

1 Answer 1

12

Use Convert Zero Datetime=true;, it's different in that it returns DateTime.MinValue instead of a MySqlDateTime.

Sign up to request clarification or add additional context in comments.

3 Comments

Hey. When I add this to my connection string, it gives an error like 'Format of the initialization string does not conform to specification starting at index 0' Here is my conn string: "<add name="xyzEntities" connectionString="metadata=res://*/xyz.csdl|res://*/xyz.ssdl|res://*/xyz.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;database=xyz&quot;Convert Zero Datetime=true;" providerName="System.Data.EntityClient" />" What should I do?
@BurakKarakuş "Convert Zero Datetime=true;" should be after "database=xyz;" not after "&quot;"
id=root;database=xyz&quot;Convert Zero Datetime=true; should be: id=root;database=xyz&quot;;Convert Zero Datetime=true; Because &quot; consumes one ; and then there is no commandseparation anymore

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.