3 Replies - 1216 Views - Last Post: 28 April 2013 - 02:37 PM Rate Topic: -----

#1 Mohsin01  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 83
  • Joined: 13-April 12

edit,Delete,Update through datagridview in c#.net sql server compact

Posted 28 April 2013 - 03:58 AM

hi guys,
i've tried much to delete the rows from data gridview and update the DB.
I can delete the rows in the datagridview with this piece of code.


foreach (DataGridViewCell oneCell in MyDataGridView.SelectedCells)
            {
                if (oneCell.Selected)
                    MyDataGridView.Rows.RemoveAt(oneCell.RowIndex);
            }


but i don't know how to update the DB.
And please tell me how to edit the DB as well .

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: edit,Delete,Update through datagridview in c#.net sql server compact

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,488
  • Joined: 12-December 12

Re: edit,Delete,Update through datagridview in c#.net sql server compact

Posted 28 April 2013 - 04:17 AM

MSDN reference - binding data to a DataGridView.

There are other approaches, including the Entity Framework.

It is possible to do the whole thing manually but it is labour-intensive and more error prone.
Was This Post Helpful? 0
  • +
  • -

#3 Mohsin01  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 83
  • Joined: 13-April 12

Re: edit,Delete,Update through datagridview in c#.net sql server compact

Posted 28 April 2013 - 04:52 AM

Sorry to say, but i don't understand this data source.

Can you please explain here that how i can update the db.
Because i don't understand msdn example.

thanks.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3806
  • View blog
  • Posts: 13,488
  • Joined: 12-December 12

Re: edit,Delete,Update through datagridview in c#.net sql server compact

Posted 28 April 2013 - 02:37 PM

View PostMohsin01, on 28 April 2013 - 11:52 AM, said:

Sorry to say, but i don't understand this data source.

Can you please explain here that how i can update the db.
Because i don't understand msdn example.

thanks.

If you are unable to follow the MSDN example then you'll need to take a few steps back in your studies of the fundamentals of VB.NET, or find another example or tutorial.

Synchronizing a form with a database is a large subject, and there are a number of ways that this can be approached, so you will need to study. There may be useful tutorials here @DIC (click the Tutorials link at the top of this page).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1