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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:03:30+00:00 2026-05-15T13:03:30+00:00

i try to learn transaction scope. Everything looks good. i try to control transaction

  • 0

i try to learn transaction scope. Everything looks good. i try to control transaction is running i add 500 char in NAME value (Name nvarchar(50) normally). While My formApplication not running (it is normal), i try to open a table table is empty. Stop running my app form . i can see values of Tables. WHY?

using (var ctx = new DataClassesCallCenterDataContext())
{
    using (var scope = new TransactionScope())
    {
        var test =
            from c in ctx.sp_CallCenterAnketEntity()
            select c;

        int? ID = test.ToList()[0].ID;

        var question = new QuestionsYesNo();
        question.Question = "Test3?";
        question.Date = DateTime.Now;

        ctx.QuestionsYesNos.InsertOnSubmit(question);
        ctx.SubmitChanges();

        Rehber rehber = (
            from r in ctx.Rehbers 
            where  r.ID == ID
            select r).First();

        rehber.Name =
            @"SQL Server 2005'i bir [many more characters] izleyin.";

        ctx.SubmitChanges();

        scope.Complete();
    }
}

i try to open QuestionsYesNo table. i can not in my application running?

  • 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-15T13:03:30+00:00Added an answer on May 15, 2026 at 1:03 pm

    Just a little rewrite to show you how you code could look like:

    // use nested using block to decrease the indent
    using (var ctx = new DataClassesCallCenterDataContext())
    using (var scope = new TransactionScope())
    {
        var test =
            from c in ctx.sp_CallCenterAnketEntity()
            select c;
    
        // if you're sure that query result will have at least one record.
        // else an exception will occur. use FirstOrDefault() if not sure.
        // and why int? - is it the type of ID. Isn't int the type?
        int? ID = test.First().ID; 
    
        // here you can use object initializer
        var question = new QuestionsYesNo
        {
            Question = "Test3?",
            Date = DateTime.Now
        };
    
        ctx.QuestionsYesNos.InsertOnSubmit(question);
        ctx.SubmitChanges();
    
        Rehber rehber = (
            from r in ctx.Rehbers
            where r.ID == ID
            select r).First(); // again about being sure and FirstOrDefault
    
        rehber.Name = @"SQL Server 2005'i bir [many more characters] izleyin.";
    
        ctx.SubmitChanges();    
        scope.Complete();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to write KSH script for processing a file consisting of name-value pairs,
Is it realistic to try and learn and code a Flex 3 application without
After I've seen this PDC session I wanted to try to learn a bit
I try to add an addons system to my Windows.Net application using Reflection; but
i try to learn asp.net Profile management. But i added below xml firstName,LastName and
i try to learn scheme and as a test project i wanted to create
Now i'm try to learn multithreading and mutext. But i don't understand it. For
Bear with me as I try to learn more about .htaccess redirect rules -
I'm new to WFP and try to learn it via different examples. Right now
I recently decided to try to learn some bash scripting and as a fun

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.