Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot retrieve record with LINQ #41

Open
jmonfu opened this issue Dec 7, 2009 · 0 comments
Open

cannot retrieve record with LINQ #41

jmonfu opened this issue Dec 7, 2009 · 0 comments

Comments

@jmonfu
Copy link

jmonfu commented Dec 7, 2009

Hi

I have a table with 2 date fields, created as the new (date) datatype in SQL Server 2008. I am managing to insert a record, however, when I try to retreive it with LINQ, I am getting an error:-

"Object of type 'System.DateTime' cannot be converted to type 'System.String'."

My LINQ is as follows:-

Resume resume = (from p in db.Resumes
where p.ResumeID == resumeID
select p).ToList().FirstOrDefault();

and the SQL that is being produced is

SELECT [t0].[CompanyAddress], [t0].[CompanyTitle], [t0].[CompanyWebsite], [t0].[DateFrom], [t0].[DateTo], [t0].[Description], [t0].[JobTitle], [t0].[ResumeID]
FROM [dbo].[Resume] AS t0
WHERE ([t0].[ResumeID] = 5)

If I change the datatype from date to datetime, everything works fine

Is there a problem with Subsonic on the new datatype (date) ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant