Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8407643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:25:21+00:00 2026-06-09T23:25:21+00:00

Entity Framework 4 . MySQL I’m trying to map a varchar column to a

  • 0

Entity Framework 4 . MySQL

I’m trying to map a varchar column to a class’s DateTime property

my class:

[Table("webnews_in")]
public class WEBNews_in : AbsNews
{
    private DateTime _inDateTimeAdded = DateTime.MinValue;

    public DateTime InDateTimeAdded
    {
        get { return _inDateTimeAdded; }
        set { _inDateTimeAdded = value; }
    }

    private DateTime _inDateTimeUpdated = DateTime.MinValue;

    public DateTime InDateTimeUpdated
    {
        get { return _inDateTimeUpdated; }
        set { _inDateTimeUpdated = value; }
    }
}

CREATE TABLE webnews_in
    (
    Id                INT NOT NULL auto_increment,
    VPN_AC              VARCHAR (20) NULL,
    InDateTimeAdded   VARCHAR (50) NULL,
    InDateTimeUpdated VARCHAR (50) NULL

    PRIMARY KEY (Id)
    );

I got this error:

    Input string was not in a correct format. 
    Message Input string was not in a correct format. 
    Data IDictionary (0 items) 


StackTrace    at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at MySql.Data.Types.MySqlDateTime.ParseMySql(String s)
   at MySql.Data.MySqlClient.MySqlDataReader.GetDateTime(Int32 i)
   at MySql.Data.Entity.EFMySqlDataReader.GetDateTime(Int32 ordinal) 
HelpLink null  
Source mscorlib 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:25:23+00:00Added an answer on June 9, 2026 at 11:25 pm

    EF throws error each time you set a type in the model that is diferent from the table, ie, if you set a field as integer in model, but this field have a type of string in the table, then in the load of data it will give you an error. To avoid it you have to make a workaround, declaring a public property with the table type equivalent and transforming it into the model desired type, try something like this:

    [Table("webnews_in")]
    public class WEBNews_in : AbsNews {
    
       private DateTime _inDateTimeAdded = DateTime.MinValue;
    
       public string InDateTimeAdded {
           get {
               return Format(_inDateTimeAdded, " dd/MM/yyyy hh:mm:ss tt");
           }
           set {
               _inDateTimeAdded = DateTime.Parse(value);
           }
       }
    
       private DateTime _inDateTimeUpdated = DateTime.MinValue;
    
       public string InDateTimeUpdated {
           get {
               return Format(_inDateTimeUpdated, " dd/MM/yyyy hh:mm:ss tt");
           }
           set {
               _inDateTimeUpdated = DateTime.Parse(value);
           }
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use MySQL (5.5.22, Connector 6.5.4) with Entity Framework 4. I'm using
I am trying use MySql and Entity Framework, using Connector/Net 6.1 with this as
I am using the Entity Framework with MySQL, and every table has a ID
I am attempting to use the MySql Entity Framework provider for a small project.
After spending a miserable month with MySQL/.NET/EntityFramework, my findings: Support for Entity Framework is
The Entity Framework has a function with this signature: public EntityTypeConfiguration<TEntityType> HasKey<TKey>(Expression<Func<TEntityType, TKey>> keyExpression);
I'm trying to make sense of a situation I have using entity framework on
I have problem with entity framework and mysql. I have solved entity framework function
I'm using MySQL with ASPNET and Membership (including Entity Framework), also with autogenerateschema=true with
I am new to entity framework and I am trying to go the Code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.