Linq to SQL binding to datagridview

Posted on 2009-12-16
Last Modified: 2013-11-11
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
Question by:MadIce
    LVL 42

    Expert Comment

    can u post the code u using?

    Accepted Solution

    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

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now