0

In my pageload I have a counter.

When it counts to 10, it has to add 10 seconds up in the database (update?), after that the timer resets, when it reaches 10 seconds again, its has to add up another 10 seconds again in the database.

(so my database keeps track on how long I've been on my page)

What sql statement do I have to use for this?

Ameya Deshpande
  • 3,580
  • 4
  • 30
  • 46
Vince
  • 13
  • 6
  • which database and what you tried ? – Ameya Deshpande Jan 23 '15 at 10:30
  • Im using C#, and Acces Database, haven't tried anything (except the counter itself) because I have no clue where to start. – Vince Jan 23 '15 at 10:31
  • what kind of application? desktop or webapplication? do you use asp.net or something similar? and if it's a webapplication is it on the clientside or serverside? and and and... – Raphael Müller Jan 23 '15 at 10:34
  • Yes Im using asp.net, but Ive made the counter in C# it self: System.Diagnostics.Stopwatch _sw = new System.Diagnostics.Stopwatch(); TimeSpan ts = _sw.Elapsed; – Vince Jan 23 '15 at 10:36
  • with this stopwatch you can just measure the time you have to compute and deliver the page. i don't think your page will take 10seconds to load? – Raphael Müller Jan 23 '15 at 10:36
  • oh no, then Im not using the right timer I think, I want to count how long I was on the page for.. – Vince Jan 23 '15 at 10:38
  • you should put what you have used in the code. then only others will come to know – Ameya Deshpande Jan 23 '15 at 10:38
  • if you want to measure the time someone spends on your site, you should use javascript and ajax or a websocket to update the time in your database. on the serverside you should program stateless. – Raphael Müller Jan 23 '15 at 10:39
  • Can you link me a spicif one for javascript + ajax? – Vince Jan 23 '15 at 10:52
  • I'm not exactly sure what you need. do you have a single page app or a normal one? anyway, have a look here: http://stackoverflow.com/questions/4667068/how-to-measure-a-time-spent-on-a-page I would go for the one with polling. – Raphael Müller Jan 23 '15 at 12:01

1 Answers1

0

The syntax for the Microsoft Access DateAdd function is:

DateAdd ( interval, number, date )

Parameters or Arguments

interval is the time/date interval that you wish to add. It can be one of the following values:

Value Explanation yyyy Year q Quarter m Month y Day of the year d Day w Weekday ww Week h Hour n Minute s Second number is the number of intervals that you wish to add.

date is the date to which the interval should be added.

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47