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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:01:21+00:00 2026-06-15T04:01:21+00:00

In a SELECT command to my SQL Server 2005 database, I need to convert

  • 0

In a SELECT command to my SQL Server 2005 database, I need to convert the OrderDelDateTime column (which is in datetime format) to a date format so that I can select all rows with today’s date, regardless of the time.

Here is what I’ve got:

cmd = New Data.SqlClient.SqlCommand("SELECT * FROM [Orders] where [OrderDelDateTime] = '" + Now.Date + "'", conn)

Obviously this returns zero results because 11/30/2012 5:30:00 PM (in db) doesn’t equal Now.Date (11/30/2012).

I’m using VB.Net.

  • 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-06-15T04:01:22+00:00Added an answer on June 15, 2026 at 4:01 am

    Make your query like this:

    select *
    from Orders
    where OrderDelDateTime between @Date1 and @Date2
    

    Then from C#, pass the following two parameters:

    cmd.Parameters.AddWithValue("@Date1", Now.Date);
    cmd.Parameters.AddWithValue("@Date2", Now.Date.AddDays(1).AddMilliseconds(-1));
    

    SQL Fiddle: http://sqlfiddle.com/#!3/92105/1

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

Sidebar

Related Questions

I have a table named t_Student in Microsoft SQL Server 2005 database. In that
I have an SQL Server 2005 database, and I tried putting indexes on the
I have created views on the SQL Server 2005 database and this view is
I can connect to my SQL Server database via sqlcmd from a DOS command
I need to register SqlDependency to watch new data on remote SQL Server (2005).
We're running our application's database on dedicated box running only SQL Server 2005. This
This is in SQL Server 2005. I have a varchar column and some rows
I created a C# program that has a SQL Server database with Visual Studio
I have a SQL Server Integration Services project which queries a SQL Server 2005
I am writing a Trans-SQL script against a MSSQL 2005 Server that intends to

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.