Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LiNQ to SQL Update Issue

Status
Not open for further replies.

djfrear

Programmer
Jul 11, 2007
83
GB
Hey,

Having a little issue with some LINQ/Lambdas code here. Now this project is about 25,000 lines and I've written plenty of different LiNQ/Lambdas statements which all work correctly - but this one bit of code refuses to work and throws no exceptions! I think I must of missed something really small, but its driving me mad so im hoping someone else may be able to see something I cant.

Code:
            try
            {
                Pickup_point pickupData = feederData.Pickup_points.Single(p => p.Interchange == cbInterchange.Text && p.Pickup_point1 == cbPickup.Text);

                pickupData.Mileage = Convert.ToDecimal(txtMileage.Text);
                pickupData.Notes = txtNotes.Text;

                feederData.SubmitChanges();
            }
            catch (Exception exc)
            {
               MessageBox.Show("Debug3: " + exc.Message);
            }

Now I have stepped through this small amount of code more times than I like to remember, everything appears to work as it should - the query returns the data I want, the new data is written to the pickup_point object (pickupData) and the SubmitChanges appears to be successful, yet no data is changed in the database!

Thanks for the help guys.

Regards, Daniel.
 
Fixed it, the table wasn't updating due to having no primary key.. duh, stupid problem to have! Odd that DLINQ didn't give an error though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top