The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.

Using Entity Framework and VS2010 to access Sybase SQL 12 database. I have a DATE (qdate) and a TIME (qtime) column in the table. Both fields are part of the table's primary key. When I attempt to retrieve any record from the table, I get the error message "The type of the key field 'qtime' is expected to be System.DateTime, but the value provided is actually of type System.TimeSpan. Has anyone else run into this and if so, how did you remedy the situation?

asked 27 Sep '12, 10:16

Bryan's gravatar image

Bryan
169239
accept rate: 0%


Here's what I eventually did to get around this. 1) since the complaint seemed to deal with using a TIME field in the Primary Key, 2) I added an autoincrement SEQNO field (bigint) and made that the Primary Key (probably a better design) and that seems to get around the issue. Fortunately I had the latitude to be able to do that, but...in the future I'll avoid using TIME columns in keys or indexes unless absolutely necessary. PB doesn't seem to have an issue with it, but Entity-Framework appears to choke on it.

permanent link

answered 27 Sep '12, 18:03

Bryan's gravatar image

Bryan
169239
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×64

question asked: 27 Sep '12, 10:16

question was seen: 1,362 times

last updated: 27 Sep '12, 18:03