I am creating a project and I have use datagridview control. Ones I have click on rows it print on excel file and ones print the record in excel this record will be delete only for today. Next day i will run the project the deleted row I want to be restored. I am able to delete row but i will ReRun project recorde will be restored. Below is the code that I have delete the row temporarily.
Int32 rowToDelete = this.dataGridView1.Rows.GetFirstRow(DataGridViewElementStates.Selected);
if (rowToDelete > -1)
{
this.dataGridView1.Rows.RemoveAt(rowToDelete);
}
And below is my code that i have to open excel and print the record.
Microsoft.Office.Interop.Excel.Application Excel = new Microsoft.Office.Interop.Excel.Application();
Workbook xlWorkBook1 = ExcelApp.Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
xlWorkBook1 = Excel.Workbooks.Open("C:\\Users\\krupal\\Desktop\\" + Todaysdate + "\\Print Voucher.XLS", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
Microsoft.Office.Interop.Excel.Worksheet Wt = (Excel.Worksheet)xlWorkBook1.Worksheets.get_Item(1);
Excel.Visible = true;
I don't know it is possible through SQL or C#.