• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 874
  • Last Modified:

Linq to SQL binding to datagridview

I had another question trying to figure out why when I try to update a field in my datagridview it tries to delete all the records in the table. I have four comboboxes that are used to allow a user to filter the results to select only related records to that selection and place those results into a datagridview.  When I first load the datagridview, everything works fine. I make changes and it updates the database. The problem is when I make a different selection in one of the comboboxes and it changes the binding source datasource to the new query. I can see the results fine. but when I make a change it tries to delete all the records in the database as oppose to updating the one field.  So my question is how do I or can I change the binding source witch is the datasource to my grid and allow updates and not deleting all my records? Or is there a better way of doing this?  using vb 2008 framework 3.5
1 Solution
Meir RivkinFull stack Software EngineerCommented:
can u post the code u using?
MadIceAuthor Commented:
I figured out the problem. I have my queries inside case statements and for some reason this is a problem. I put each in a procedure and it solved the problem.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now