Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7534951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:09:52+00:00 2026-05-30T06:09:52+00:00

In my WCF web service I have been reading from the database with no

  • 0

In my WCF web service I have been reading from the database with no trouble at all. Today I attempted an update but quickly discovered the changes weren’t actually being saved to the database. I am getting no errors or exceptions thrown. I have spent the last several hours researching the problem with no luck. I have found many similar questions but most of he time the reason was that the table being written to didn’t have a primary key, however this is not the case with this table.

Here’s some code:

var db = new dbDataContext(Convert.ToString(ConfigurationManager.AppSettings["sConn"]));

...


        var bookingRow = (from mBooking in db.d_bookings
                          where mBooking.booking_id == bookingID
                          select new BookingResult
                          {
                              guideID = mBooking.user_id_guide == null ? 0 : (int)mBooking.user_id_guide,
                              adultShow = mBooking.booking_nAdults_show == null ? 0 : (int)mBooking.booking_nAdults_show,
                              childShow = mBooking.booking_nChild_show == null ? 0 : (int)mBooking.booking_nChild_show,
                          }
                          ).Single();

        bookingRow.guideID = someNewValue;
        bookingRow.adultShow = someNewValue;
        bookingRow.childShow = someNewValue;

        try
        {
            db.SubmitChanges();
        }
        catch (Exception ex)
        {
            return "{\"result\" :  \"false\" }";

        }

And the BookingResult class is simply:

public class BookingResult
{
    public int guideID { get; set; }
    public int adultShow { get; set; }
    public int childShow { get; set; }
}

This is my first project working with WCF and LINQ and it seemed incredibly straight forward for the most part but this has thrown me for a loop. Any help is greatly appreciated!

SOLVED: The problem was that I was reading into the custom class which wasn’t attached to my DataContext. Removing the class and just selecting the entire row works fine.

var bookingRow = (from mBooking in db.d_bookings
                      where mBooking.booking_id == bookingID
                      select mBooking
                  ).Single();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:09:54+00:00Added an answer on May 30, 2026 at 6:09 am

    You’re creating a completely new BookingResult that would not be attached to the DataContext and therefore will not be considered as a change when you call SubmitChanges. Is there a table in the database called BookingResults? What do you hope will happen to your new BookingResult? Would it create a new row?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF Web Service which is referenced from a class library. After
I have a WCF web-service and a Silverlight app displaying data from that service.
So I came across an interesting problem today. We have a WCF web service
I have been building a Asp.net WCF web service with json format. Now I
I have been tasked with securing a web service that uses WCF and offers
I have a simple WCF Web service. It's hosted on IIS under the default
I have a wcf web service and I need to provide the client with
I have a WCF web service, and I want to use Basic authentication. I
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I have a website that talks to a remote WCF web service. Both use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.