Hemant Kumar
Hemant Kumar

Reputation: 4611

How to do insert data every minute into SQL Server

I have to write a data logger application. I want it to insert data into the database every minute (seconds time must be zero). how can I do this? Can I use delegates for inserting? If yes how can I do this?

Upvotes: 1

Views: 754

Answers (2)

Akram Shahda
Akram Shahda

Reputation: 14781

Check the value of the DateTime.Now.Minute and DateTime.Now.Second to get the value of the current time.

Handle the Timer class Elapsed event to execute your code in an interval basis.

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1039190

You could use a Timer to execute recurring events at regular intervals.

Upvotes: 1

Related Questions