views:

32

answers:

0

I am connecting to a MySQL database from Visual Studio 2010 using Net/Connector.

This is the entity framework 4 linq query:

        int timeThreshold = 5;
        DateTime cutoffTime = DateTime.Now.AddMinutes(-timeThreshold);

        try
        {
            using (var context = new myEntities())
            {

                var unprocessedMessages = from m in context.messages
                                          where m.createdDate < cutoffTime
                                          select m;

            }
        }
        catch (Exception e)
        {
            string exceptionString = e.InnerException.ToString();
        }

The Results view in the expanded unprocessedMessages displays an exception:

  • base {"An error occurred while executing the command definition. See the inner exception for details."} System.Data.EntityException {System.Data.EntityCommandExecutionException}

I am trying to see what the inner exception is. However, the catch block is never entered. What is happening here?