【发布时间】:2018-07-19 04:56:58
【问题描述】:
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();
}
但是这里的行给我错误数据网格不包含行的定义 并在阅读每一行后将该行添加到 sqlite 数据库中
【问题讨论】:
-
请帮我解决这个问题