Workbook workbook = new Workbook();
workbook.LoadFromFile(FileNameDb);
Worksheet sheet = workbook.Worksheets[0];
DataTable dataTable = sheet.ExportDataTable();
DataView view = new DataView(dataTable);
dataGridView1.ItemsSource = view;
string str;
for (int i = 0; i < dataGridView1.Items.Count - 1; i ++)
{
str = "Insert Into Sample(MCC, MNC, LAC, CellId, CellIdAddress, LAT, LONG, Network)
Values(" + dataGridView1.Rows[i].Cells[0].Value.ToString() + ", '" +
dataGridView1.Rows[i].Cells[1].Value.ToString() + "'," +
dataGridView1.Rows[i].Cells[2].Value.ToString() + "," +
dataGridView1.Rows[i].Cells[3].Value.ToString() + "," +
dataGridView1.Rows[i].Cells[4].Value.ToString() + "," +
dataGridView1.Rows[i].Cells[5].Value.ToString() + "," +
dataGridView1.Rows[i].Cells[6].Value.ToString() + "," +
dataGridView1.Rows[i].Cells[7].Value.ToString() + ")";
command = new SQLiteCommand(str, m_dbConnection);
command.ExecuteNonQuery();
}
But Rows here give me error data grid does not contain a definition for Rows and after reading every line add that line in sqlite database