public void ExportDrawing_ToDataBase_Test2(int deptID, int projID, int leadID, int no, string FN, string location) { // MessageBox.Show(fName); Excel.Application excelApp3 = new Excel.Application(); string fName2 = location + "\\" + FN + ".xls"; // MessageBox.Show(fName2); Excel.Workbook excelWorkbook3 = excelApp3.Workbooks.Open(fName2, 0, false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true, false, 0, true, false, false); // workBook = excelApp.Workbooks.Add(misValue); excelApp3.DefaultSaveFormat = Excel.XlFileFormat.xlOpenXMLWorkbook; Excel._Worksheet workSheet3 = excelApp3.ActiveSheet; int lastRow = 0; for (int i = 1; i < (no + 5); i++) { if (workSheet3.Cells[i, 6].Text == "") { lastRow = i; // MessageBox.Show("Emply" + "found @" + lastRow); break; } } //for (int indx = 2; indx < lastRow; indx++) //{ // int ID = LoadScreenToObject_X(indx, deptID, projID,leadID, workSheet3); // if (ID == 0) // { // // MessageBox.Show("Return of ID Test for..." + ID + "....." + "..So Insert"); // moDrwLog.Save_Insert(); // } // else // { // // MessageBox.Show("Return of ID Test for..." + ID + "....." + "..So Update"); // moDrwLog.Save_Update(); // } //} for (int indx = 2; indx < lastRow; indx++) { LoadScreenToObject_X(indx, deptID, projID, leadID, workSheet3); if (indx <= no) { // MessageBox.Show("Return of ID Test for..." + ID + "....." + "..So Insert"); //MessageBox.Show(indx.ToString() + ".....update"); moDrwLog.Save_Update(); } else { // MessageBox.Show("Return of ID Test for..." + ID + "....." + "..So Update"); // MessageBox.Show(indx.ToString() + ".....insert"); moDrwLog.Save_Insert(); } } excelApp3.Quit(); }