Community discussion forum

How to run a fuction contineously in asp.net

  • 10 months ago
    Hi friends , i need a solution for working a function that work automatically it will stop only if server stop . am develop an asp.net application for vehicle tracking then i get messages from an sdk dll . the details is get a particular code will work conterminously so i need a solution for that (in asp.net (vb or C#) ) example SqlCommand cmd = new SqlCommand(); /* getconnection is a class used to connect databse */ GetConnection connect = new GetConnection(); public void getdata() { if(connect.con.State= ConnectionState.Close) connect.con.Open(); cmd.Connection = connect.con; cmd.CommandType = CommandType.Text; cmd.CommandText = "select msgid from sdktable where id=111"; int i1 = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandText = "select isnull(max(id),0)+ 1 from table2 "; int id = Convert.ToInt32(cmd.ExecuteScalar()); cmd.CommandType = CommandType.Text; cmd.CommandText = "Insert into table2 values("+ id +","+ i1 +")"; cmd.ExecuteNonQuery(); connect.con.Close(); } i need getdata() work continuously if it stop only when sever stopped any idea please help me thank in adavnce By Pratheej
  • 10 months ago
    You can use the Service class of Microsoft.SqlServer.Management.Smo.Wmi to do this.
  • 9 months ago
    you can use window service, for continuously Polling that function.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!