4 Replies - 5167 Views - Last Post: 25 May 2013 - 04:39 AM Rate Topic: -----

#1 pc20912   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 14-April 13

SQL "Select" command from Current Date

Posted 22 May 2013 - 10:27 PM

I put many dates in database field.

How write SQL command to select Very Next row from current date. (Checking only Month and Date)
Is This A Good Question/Topic? 0
  • +

Replies To: SQL "Select" command from Current Date

#2 Nana Nyarko Abronomah   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 03-November 10

Re: SQL "Select" command from Current Date

Posted 22 May 2013 - 10:39 PM

SELECT * FROM your_table WHERE Date_Column > DATE CURDATE() ORDER BY Date_Column

--The First row will be the next date from the current date
Was This Post Helpful? 0
  • +
  • -

#3 pc20912   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 14-April 13

Re: SQL "Select" command from Current Date

Posted 22 May 2013 - 10:47 PM

Thanks for your Reply.
I have another Question.

If I want to select 3rd (or any next row number)next row from current date, How can I use it, Please show me.
I want to check with out year (Only Month and Date)
Was This Post Helpful? 0
  • +
  • -

#4 Linesofcode   User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 62
  • Joined: 23-May 13

Re: SQL "Select" command from Current Date

Posted 23 May 2013 - 04:03 AM

Usually you send the info from Database to a Dataset. From that Dataset, you can send the information to a Datatable, where you'll be doing some queries.

Dim table As New DataTable
table = dataSet1.Tables(nametable)
Dim query As String = String.Format("[fieldDate] > '{0}'", DateTime.Now.AddDays(3).ToString("yyyy/MM/dd"))

DataGridView1.DataSource = table.Select(query, "ORDER BY field DESC").CopyToDataTable()

Was This Post Helpful? 0
  • +
  • -

#5 pc20912   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 14-April 13

Re: SQL "Select" command from Current Date

Posted 25 May 2013 - 04:39 AM

with "DateTime.Now.AddDays()" - add number of days to current date.
I mean with 03rd next row, its may be not 03 days after current date.

I use this for task scheduler.
To Find next task.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1