I've a button on my frmMain that opens up another frmEdit which has a datagridview that displays the following query:
BindingSource bs = new BindingSource();
string sqlqry = "select p_Name from Items where p_Id=" + p_Id;
SqlCeCommand cmd = new SqlCeCommand(sqlqry1, conn);
SqlCeDataReader rdr = cmd.ExecuteReader();
bs.DataSource = rdr;
dataGridView1.DataSource = bs;
this.ShowDialog(parent);
When frmEdit loads up the DataGridView
displays the query just fine, but I can't Edit. I tried dgv.BeginEdit(true)
, but it doesn't work. The EditMode works fine if I used wizard to bind datasources to the dgv, but I need to execute my own customized queries and be able to update them directly.
You need a bidirectional datasource.
I think you can use SqlCeResultSet
instead of a SqlCeDataReader
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.