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 7590467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:24:31+00:00 2026-05-30T20:24:31+00:00

I have a project that inserts personal information to a table and details into

  • 0

I have a project that inserts personal information to a table and details into another table. But sometimes personal information cannot be recorded, however details are recorded. As below code part, firstly personal information are inserted, then details. But sometimes personal information doesn’t get saved and userId returns 0, So details are saved. I don’t know why it doesn’t work. Any idea?

 public int ConferenceIdyeGoreKisiBilgileriniKaydet(string orderId)
 {
        KisiselBilgilerBal kisiBilgileri = (KisiselBilgilerBal)Session["kisiselBilgilerSession"];
        registrationCode = GenerateGeristrationCode();
        string toplamMaliyet = Session["toplamOdeme"].ToString();
        PersonalInformation.SavePersonalInformations(kisiBilgileri,  registrationCode,conferenceName);
        int userId = AuthorPaperDetaylari.AdVeSoyadaGoreIdGetir(kisiBilgileri.f_name, kisiBilgileri.l_name);
        AuthorPaperDetaylari.SaveAuthorPaperDetails(authorPaperDetay, userId); // save details via userId.

        return userId;
    }

This method saves personal information.

public static void SavePersonalInformations(KisiselBilgilerBal kisiBilgileri,string  registrationCode,string conferenceName)
{
        try
        {
            string cs = ConfigurationManager.AppSettings["SiteSqlServer"];
            DBDataContext db = new DBDataContext(cs);
            DBpersonalInformation personalInfo = new DBpersonalInformation();
            personalInfo.f_name = kisiBilgileri.f_name;
            personalInfo.l_name = kisiBilgileri.l_name;
            personalInfo.university_affiliation = kisiBilgileri.university_affiliation;
            personalInfo.department_name = kisiBilgileri.department_name;
            personalInfo.address1 = kisiBilgileri.address1;
            personalInfo.address2 = kisiBilgileri.address2;
            personalInfo.city = kisiBilgileri.city;
            personalInfo.state = kisiBilgileri.state;
            personalInfo.zipCode = kisiBilgileri.zipCode;
            personalInfo.country = kisiBilgileri.country;
            personalInfo.phone = kisiBilgileri.phone;
            personalInfo.email = kisiBilgileri.email;
            personalInfo.orderId = kisiBilgileri.orderId;
            personalInfo.registrationCode = registrationCode;
            personalInfo.date = DateTime.Now;
            personalInfo.conferenceName = conferenceName;
            db.DBpersonalInformations.InsertOnSubmit(personalInfo);
            db.SubmitChanges();
        }
        catch (Exception)
        {
        }
    }

This method saves details

public static void SaveAuthorPaperDetails(AuthorPaperDetailsBal authorPaperDetay, int userId)
{
        try
        {
            string cs = ConfigurationManager.AppSettings["SiteSqlServer"];

            DBWebDataContext db = new DBWebDataContext(cs);

            DBAuthorPaperDetail authorPaperDetail = new DBAuthorPaperDetail();

            authorPaperDetail.paper_title = authorPaperDetay.paperTitleDetails;
            authorPaperDetail.conference_maker_id = authorPaperDetay.confMakerId;
            authorPaperDetail.additional_paper_title = authorPaperDetay.additionalPprTtle;
            authorPaperDetail.areYouMainAuthor = authorPaperDetay.mainAuthor;
            authorPaperDetail.feeForFirstAuthorPaper = authorPaperDetay.registerFeeForFirstAuthor;
            authorPaperDetail.feeForAdditionalPaper = authorPaperDetay.regFeeForAdditionalPape;
            authorPaperDetail.feeForParticipCoAuthors = authorPaperDetay.regFeeForCoAuthors;
            authorPaperDetail.userId = userId;
            authorPaperDetail.firstCoAuthorName = authorPaperDetay.firstCoAuthor;
            authorPaperDetail.secondCoAuthorName = authorPaperDetay.secondCoAutho;
            authorPaperDetail.thirdCoAuthorName = authorPaperDetay.thirdCoAuthor;
            authorPaperDetail.toplamOdeme = authorPaperDetay.toplamMaliyet;
            db.DBAuthorPaperDetails.InsertOnSubmit(authorPaperDetail);
            db.SubmitChanges();
        }
        catch (Exception)
        {
        }
    }
  • 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-30T20:24:33+00:00Added an answer on May 30, 2026 at 8:24 pm

    In addition to Marc’s answer… You are calling SubmitChanges twice. If you want atomic data storage, you should call it once. You can use relational properties to create an object graph, and submit the whole graph at once.

    public void SaveParentAndChildren()
    {
      using (CustomDataContext myDC = new CustomDataContext())
      {
        Parent p = new Parent();
        Child c = new Child();
        p.Children.Add(c);
        myDC.Parents.InsertOnSubmit(p); //whole graph is now tracked by this data context
        myDC.SubmitChanges(); // whole graph is now saved to database
        // or nothing saved if an exception occurred.
    
      }  //myDC.Dispose is called for you here whether exception occurred or not
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project that I'm currently working on but it currently only supports
I have a project that I thought was going to be relatively easy, but
I have a project that builds fine If I build it manually but it
I have a little script that compiles a markdown file into html, and inserts
I have a large table (~10 million records) that contains several keys into other,
I have project that I'm working on that is going to require a webserver.
I have a project that I would like to start beta testing soon, it
I have a project that I'm working on and I need to be able
We have a project that generates a code snippet that can be used on
I have a project that I am building with Netbeans 6.1 and I am

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.