public String run() { // step 1: retrieve EMPLOYEE table from database SqlConnection con = new SqlConnection(); con.ConnectionString = Convert.ToString(ConfigurationManager.ConnectionStrings["connection"]); SqlDataAdapter sc = new SqlDataAdapter("SELECT EID,SCID FROM EMPLOYEE", con); DataTable dte = new DataTable(); sc.Fill(dte); int said = 100; String test = ""; foreach(DataRow dr in dte.Rows) { said++; String eid = dr["EID"].ToString(); String scid = dr["SCID"].ToString(); //step 2: GET ADJUSTMENTS Adjustment adj = new Adjustment(Convert.ToInt32(eid)); double d = adj.getDeductionOnGross(); double i = adj.getIncrementOnBasic(); Salary salary = getSalary(Convert.ToInt32(scid), i, d); double basic = salary.getBasic(); double da = salary.getDA(); double hra = salary.getHRA(); double pf = salary.getPF(); double gross = salary.getGross(); double netpay = salary.getNetpay(); test = test + "--" + basic + "," + da + "," + hra + "," + pf + "," + gross + "," + netpay; //insertIntoDispatch(); SqlConnection con2 = new SqlConnection(); con2.ConnectionString = Convert.ToString(ConfigurationManager.ConnectionStrings["connection"]); SqlCommand com2 = new SqlCommand("INSERT INTO DISPATCH (EID,MONTH,YEAR,BASIC,DA,HRA,PF,GROSS,NETPAY) VALUES("+eid+","+month+","+year+","+basic+","+da+","+hra+","+pf+","+gross+","+netpay+")", con2); con2.Open(); com2.ExecuteNonQuery(); con2.Close(); // step 3 insert all details into DISPATCH database table. } return "SUCCESSFULLY INSERTED"; }