data is not updating in Database real-time using windows service

February 28, 2018, at 11:23 AM

I have written a windows service to get data from a CSV file and write them back to the database. It is working smoothly as I expected. But there is an issue with updating the data. My intention is to get update the changes of the CSV file back to database right away. Although my windows service runs in background when I change the data in the csv file it won't update the database for some reason. I even tried to restart the windows service. But no luck that either. I can insert my coding down below.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using MySql.Data;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;
namespace abpservice
    public partial class Service1 : ServiceBase
        private Timer timer1 = null;

        public Service1()
        public void onDebug()
        protected override void OnStart(string[] args)
            timer1 = new Timer();
            this.timer1.Interval = 30000; //every 30 seconds
            this.timer1.Elapsed += new System.Timers.ElapsedEventHandler(this.timer1_Tick);
            timer1.Enabled = true;
            library.WriteErrorLog("windows service started");
        private void timer1_Tick(object sender, ElapsedEventArgs e)
            string connStr = "server=localhost;user=root;database=database;port=3306;password=123456";
            MySqlConnection conn = new MySqlConnection(connStr);
            MySqlBulkLoader bl = new MySqlBulkLoader(conn);
            bl.TableName = "jobs";
            bl.FieldTerminator = ",";
            bl.LineTerminator = "\n";
            bl.FileName = @"C:\Users\source\repos\WindowsService1\WindowsService1\bin\Debug\jobs.csv";
            //bl.FileName = bl.FileName.Replace(@"\\", @"\ \");
            bl.NumberOfLinesToSkip = 1;
                Console.WriteLine("Connecting to MySQL...");
                // Upload data from file
                int count = bl.Load();
                Console.WriteLine(count + " lines uploaded.");

            catch (Exception ex)
            library.WriteErrorLog("Timer ticked and some  jobs have been done sucessfully");
        protected override void OnStop()
            timer1.Enabled = false;
            library.WriteErrorLog("Test window service stopped");

If someone could catch why the changes in the CSV file did not get updated real-time in the database please do not hesitate to put an answer. That might help me a lot to finish this task.

mysql: difference between values in one column

mysql: difference between values in one column

this board helped me a few times in the past

Why is this Union Query not working

Why is this Union Query not working

I am trying to access multiple tables from mySQL via my php in wordpressMy code looks like this

explode results then implode php

explode results then implode php

I'm getting the contents of a column which has contents stored as 3,2 then I'm using the explode function to separate themThe values separated are then used to query another table to bring names

Delete a row from the table

Delete a row from the table

I created a schema in mysql MyISAM with the help of the followingsql: