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 4027618
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:07:08+00:00 2026-05-20T11:07:08+00:00

I am moving from SQL to Linq and I need some help. I am

  • 0

I am moving from SQL to Linq and I need some help. I am testing both Linq-to-SQL and Linq-to-Entities. I want to try both to decide which one suits me best. Your help is appreciated. Thanks

What is the correct syntax (in vb.net if possible) to select the minimum date value from a table?

Dim mydata As New DataClassesDataContext
Dim myresult = From cv In mydata.T1s
                       Select cv.DATE1, cv.Date2, cv.Datex
myresult=Dump()

I have tried I have tried to use

Select amin=cv.DATE1.Min(), amax=cv.Date1.Max(), bmin=cv.Date2.Min(), etc....

is giving this error 'Min' is not a member of 'Date'.

The Data That I want to get min and max on is below:

IOrderedQueryable<VB$AnonymousType_0<DateTime,DateTime>> (16 items) 

Date1                   Date2
17/Oct/09 12:00:00 AM   23/Oct/09 12:00:00 AM
10/Jan/09 12:00:00 AM   15/Feb/09 12:00:00 AM
27/Mar/09 12:00:00 AM   27/Mar/09 12:00:00 AM
30/May/09 12:00:00 AM   30/May/09 12:00:00 AM
25/Jan/09 12:00:00 AM   25/Mar/09 12:00:00 AM
01/Nov/09 12:00:00 AM   01/Nov/09 12:00:00 AM
21/Feb/09 12:00:00 AM   04/Mar/09 12:00:00 AM
02/Mar/09 12:00:00 AM   09/Mar/09 12:00:00 AM
07/Jul/09 12:00:00 AM   07/Jul/09 12:00:00 AM
27/Sep/09 12:00:00 AM   27/Sep/09 12:00:00 AM
05/Nov/09 12:00:00 AM   05/Nov/09 12:00:00 AM
15/Apr/09 12:00:00 AM   15/Apr/09 12:00:00 AM
08/Jun/09 12:00:00 AM   08/Jun/09 12:00:00 AM
07/Jul/09 12:00:00 AM   07/Jul/09 12:00:00 AM
30/Jul/09 12:00:00 AM   30/Jul/09 12:00:00 AM
04/Nov/09 12:00:00 AM   04/Nov/09 12:00:00 AM

Now resolved, but this is not a the perfect solution, it seems that I needed to do a seperate query for each column that requires aggreagate function :

Sub Main

Dim mm = (From cv In T1s 
Select Datez = (cv.Date1)).Min()

Dim mm1 = (From cv In T1s 
Select Datez = (cv.Date1)).Max()

Dim mm2 = (From cv In T1s 
Select Datez = (Date2)).Min()

Dim mm3 = (From cv In T1s 
Select Datez = (Date2)).Max()
mm.dump()
mm1.dump()
mm2.dump()
mm3.dump()

End Sub

The Results are below

10/Jan/09 12:00:00 AM
05/Nov/09 12:00:00 AM
15/Feb/09 12:00:00 AM
05/Nov/09 12:00:00 AM
  • 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-20T11:07:09+00:00Added an answer on May 20, 2026 at 11:07 am

    This should work for you

    //Retrieve Minimum Date
    var MinDate = (from d in dataRows select d.Date).Min();
    
    //Retrieve Maximum Date
    var MaxDate = (from d in dataRows select d.Date).Max(); 
    

    (From here)

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

Sidebar

Related Questions

I'm moving DB from MySQL (used ODBC) to MS SQL and I want to
What are best practices for moving/exporting SQL Server Integration Services Packages from a SQL
We are moving from regular 2.0 webforms with no testing to TDD MVC I'm
My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy
We're looking at moving from a check-out/edit/check-in style of version control system to Subversion,
I am moving from classic ASP to ASP.NET and have encountered what many of
We are looking at moving from Visual Studio 2008 Professional to Visual Studio Team
My company is moving from CVS to SVN. With CVS, I made branches for
We are moving from ClearCase to TFS2008. I easily found the MS migration tool
I'm looking at maybe moving from an older AMD64 to a new Intel dual-core

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.