如何使用SqlCeDataAdapter编辑datagridview?
我有一个带有 datagridview 的 frmEdit ,它与此相关:
string sqlqry1 = "select p_Name from Items where p_Id=" + p_Id;
using (SqlCeDataAdapter a = new SqlCeDataAdapter(sqlqry1, conn))
{
DataTable dt1 = new DataTable();
a.Fill(dt1);
dataGridView1.DataSource = dt1;
}
How to edit cells and save them back to the db?,尝试使用这个:
using (SqlCeDataAdapter a = new SqlCeDataAdapter(sqlqry1, conn))
{
DataTable dt1 = new DataTable();
a.Fill(dt1);
dataGridView1.DataSource = dt1;
a.Update(dt1);
}
Nothing。
到底还有吗?
I've a frmEdit with datagridview that's bouned to this:
string sqlqry1 = "select p_Name from Items where p_Id=" + p_Id;
using (SqlCeDataAdapter a = new SqlCeDataAdapter(sqlqry1, conn))
{
DataTable dt1 = new DataTable();
a.Fill(dt1);
dataGridView1.DataSource = dt1;
}
How to edit cells and save them back to the db?, tried using this:
using (SqlCeDataAdapter a = new SqlCeDataAdapter(sqlqry1, conn))
{
DataTable dt1 = new DataTable();
a.Fill(dt1);
dataGridView1.DataSource = dt1;
a.Update(dt1);
}
Nothing.
Is there anyway?.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
找到解决方案:
Found solution:
由于该页面在谷歌上的排名,因此用一个工作示例来复活它。
Resurrecting this with a working example because of this pages rank on google.