0
我有我想从数据网格视图数据复制到数据库表中的数据网格视图,它抛出mysql的异常,请帮助这里是我的代码MySQL的例外在复制数据从网格视图,数据库表
foreach (DataGridViewRow row in dataGridView2.Rows)
{
if (row.Cells[0].Value != null) //if id is not null
{
string mysqlStatement = "INSERT INTO test1(Paper, Authors, ID, GSCitations) VALUES('" + row.Cells[0].Value + "','" + row.Cells[1].Value + "','" + row.Cells[2].Value + "','" + row.Cells[3].Value + "');";
MySqlCommand mysqlCmd = new MySqlCommand(mysqlStatement, connection);
mysqlCmd.ExecuteNonQuery();
}
}
错误的整数值:第1行'ID'列'可分组可验证内容选择性公开'是错误
你能在这里粘贴MySQL的例外呢? – sics 2013-02-24 14:52:10
看起来像row.Cells [0] .Value是在行133无效的ID。 – sics 2013-02-24 14:53:13
现在我看到没有id是133我有id到132,为什么没有循环停在132? – mani1989 2013-02-24 14:57:08