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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:40:57+00:00 2026-06-10T03:40:57+00:00

SELECT DateDiff(n, LastDate, Now()) as datediffs FROM UserLog WHERE ID = 1 When I

  • 0
SELECT DateDiff("n", LastDate, Now()) as datediffs FROM UserLog WHERE ID = 1

When I execute this query from Query Design View (MS Access). This give me different in minutes well like this:

datediffs
---------
2826

But when I execute the same query (including static value in where condition ID = 1) from servlet like this:

strSql = "SELECT DateDiff(\"n\", LastDate, Now()) as datediffs FROM UserLog WHERE ID = 1";
recset=stmt.executeQuery(strSql);

It gives me the following error:

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected
1.

So what wrong with me?

  • 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-10T03:40:59+00:00Added an answer on June 10, 2026 at 3:40 am

    Write-up of comments from above.

    If

    SELECT TOP 5 id, lastdate FROM UserLog 
    

    runs, then you need to look at the various other parts of your statement. For example, Now() can cause a problem if the database has lost references.

    However, you report

    I executed SELECT DateDiff("n", LastDate, ’20-08-2012 5:15:10 PM’)
    Which did not executed. When I tried this one SELECT LastDate, NOW()
    FROM … it was executed successfully. So I suspect the problem is
    with Datediff() function. (–- @hims056, OP)

    Which is odd, because DateDiff notmally works outside of MS Access. However, I notice that this problem is reported in Oracle Bugs. In the comments, one person mentions that in his or her case, the problem was a misnamed column, so it may be possible to use ACE, rather than Jet for the connection. Alternatively, as you say, "get datediff in minutes from Java."

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

Sidebar

Related Questions

I have a the query: SELECT availables.bookdate AS Date, DATEDIFF(now(),availables.updated_at) as Age FROM availables
I have the following query which have 1000 rows select staffdiscountstartdate,datediff(day,groupstartdate,staffdiscountstartdate), EmployeeID from tblEmployees
This line of code is a snippet from my select statement. frdFreedays - DateDiff(dd,conReceiptToStock,GetDate())
This is my query select dtfromdate, dttodate, (SELECT DATEDIFF(day, dtfromdate, dtTodate)) AS NumberOfDays, fltspl
This is my current query: select serial_number, order_number, (select TOP 1 PRODUCT_ID from PS_ORD_LINE
i want to get date difference. i am using this query:- SELECT DATEDIFF('2012-08-01', '1978-12-06')
Can this be done w/ linqtosql? SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime FROM Incidents GROUP
I have two queries use [DatabaseAA] select * ,DATEDIFF(MINUTE,SomeDate,'3/28/2012 12:52:25 PM +00:00') This passes,
See the following SQL statement: SELECT datediff(d, MAX(invoice.date), Now) As Date_Diff , MAX(invoice.date) AS
I want to get a total days between 2 dates Query Select DATEDIFF(DAY, CONVERT(DATETIME,

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.