How to edit datagridview using SqlCeDataAdapter?

Posted by DanSogaard on Stack Overflow See other posts from Stack Overflow or by DanSogaard
Published on 2010-03-09T03:33:26Z Indexed on 2010/03/09 3:36 UTC
Read the original article Hit count: 295

Filed under:
|
|

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?.

© Stack Overflow or respective owner

Related posts about datagridview

Related posts about c#