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

  • Home
  • SEARCH
  • 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 7510089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:07:34+00:00 2026-05-29T23:07:34+00:00

I am new to linq and linq2SQL. I have done my homework, i.e. found

  • 0

I am new to linq and linq2SQL. I have done my homework, i.e. found many results and answers that target similar problems. Seemingly lacking deeper understanding of linq and linq2SQL I am at my wits end.

I have a web application with a simple html and js frontend. I exchange data with my aspx via ajax xmlhttprequests. All the data naturally comes in and is supposed to go out as strings.

What I am trying to do:

  private DateTime _date;

  [Column(Storage = "_date", Name = "date", DbType = "date", CanBeNull = false)]
  public string date 
    {
       get { return this._date.ToString("yyyy-MM-dd"); }
       set { this._date = DateTime.ParseExact(value, "yyyy-MM-dd", null); }
    }

Instead of converting the string to a datetime in my aspx I would like to just pass on the strings and do the conversion at get and set. Running this code gives me an “invalid cast” error.

Am I trying to do something that is by desing simply not supposed to be done? Is my approach wrong? I don’t expect someone else to write the code for me. I don’t mind digging in the references, but I don’t know where to start. So if someone where to point me in the right direction, I would greatly appreciate it.

  • 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-05-29T23:07:36+00:00Added an answer on May 29, 2026 at 11:07 pm

    Solution for now:

    [Column(Name = "date", DbType = "date", CanBeNull = false)]
    public string date { get; set; }
    

    Apperently linq or “whoever” is responsible can figure the casting out on it’s own, if you let it. Right now that’s good enough for me.

    I have the feeling I will run into simliar casting problems later on and that different solutions may be required. If so I will update this thread.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im new to linq so i still struggle .... I have a collection of
I am somewhat new to LINQ and have a quick question regarding deleting. Say,
I am still new to LINQ, and I have wrestled with a query for
I'm relatively new to .NET and have being using Linq2Sql for a almost a
I have been working with simple linq2sql statements for a bit but am new
I'm new to LINQ and C# but I have an xml file generated from
I am very new in LINQ I have written following query : var duplicate
I very new to Linq and Entity frame work, i have problem with my
There is a proliferation of new LINQ providers. It is really quite astonishing and
New to LINQ.. I am curious as to the syntax to do the following

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.