using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceProcess;
using System.Data.SqlClient;
namespace MyWindowsService
{
class Program : ServiceBase
{
static void Main(string[] args)
{
ServiceBase.Run(new Program());
}
public Program()
{
this.ServiceName = "My Service";
string Message;
SqlConnection con = new SqlConnection("Data Source=DEJAN-PC\\SQLEXPRESS;Initial Catalog=pn365net;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("insert into tbl_test(test) values(@test)", con);
cmd.Parameters.AddWithValue("@test", "dsada");
int result = cmd.ExecuteNonQuery();
if (result == 1)
{
// Message = userInfo.UserName + " Details inserted successfully";
}
...
Go to the complete details ...