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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:46:22+00:00 2026-05-14T21:46:22+00:00

How can i compare the day in the access database to a given day

  • 0

How can i compare the day in the access database to a given day in c#?
The date column in the database is an general date(day/month/year)

           try
        {

           database = new OleDbConnection(connectionString);
           database.Open();
           date = DateTime.Now.ToShortDateString();
           string queryString = "SELECT user_name,zivila.naziv "
               + "FROM (users LEFT JOIN obroki_save ON obroki_save.ID_uporabnika=users.ID)"
               + " LEFT JOIN zivila ON zivila.ID=obroki_save.ID_zivila "
               + " WHERE users.ID= " + a.ToString() + " AND obroki_save.datum=# " + date; 
           loadDataGrid(queryString);
       }
       catch (Exception ex)
       {
           MessageBox.Show(ex.Message);
           return;
       }
  • 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-14T21:46:22+00:00Added an answer on May 14, 2026 at 9:46 pm

    You need a hash (#) after the date literal also. You might also have to specify a culture when formatting the date to get it to match what the database expects, or use a specific format string.

    However, you should rather use parameters than inserting the value in the query. Then you don’t have to worry about getting the date format to match what the database might expect.

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

Sidebar

Related Questions

How can I compare if two DateTime objects have the same day,month and year?
How can I compare the items in two lists and create a new list
Good day, i will try to explain my problem as best as i can.
It seems I can't compare 2 date values with time. When I compare just
this is my code: var currentTime = new Date() var month = currentTime.getMonth() +
I am trying to take 3 separate integer inputs (year,month,day) and taking these 3
I am looking for a gem that can compare two strings (in this case
is there a way l can compare two columns | fields in django like
I would like to know if there is anyway I can compare two columns
I have an IEnumerable, listOfOnes, and an IEnumerable, listOfTwos. Assuming that I can compare

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.