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

  • Home
  • SEARCH
  • 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 7511911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:42:20+00:00 2026-05-29T23:42:20+00:00

The problem is "after inserting a data using linq2sql & do submit changes ,

  • 0

The problem is "after inserting a data using linq2sql & do submit changes , I cant find the data in database " I will explain more :
first here’s my DB design :
enter image description here

I made sure that I got primary keys for auto insert
I made sure that the data context is in the same path as my .mdb file lies
I used server explorer in VS2010 to check for the DB data

Here’s the function I use to insert a simple data:

 public static bool add_contractor(string name,string ssn, string address)
        {
            Contractor co = new Contractor();
            co.co_address = address;
            co.co_name = name;
            co.co_ssn = ssn;
            db.Contractors.InsertOnSubmit(co);
            try
            {
                db.SubmitChanges();
                

            }
            catch (Exception)
            {

                return false;
            }
            return true;
        }

I did debugging & checked for the function , I got no error on submitting & the data should be submitted .

While I’m running the [program & using the following function to get the data from the table "contractor" :

  public static Contractor[] get_contractors()
        {
            var ret = from p in db.Contractors
                      select p;

            return ret.ToArray<Contractor>();
        }

then displaying it I found the data I inserted … great till now ,

I go to server explorer & check for the data but I don’t find it …. strange huh

I use the function again & it tells me that the data I inserted exists….
The moment I close my program & re run it I dont find the data I inserted .

  • 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-29T23:42:22+00:00Added an answer on May 29, 2026 at 11:42 pm

    You mentioned you are using an mdb file, if it is set to copy always, every time you debug it will overwrite it. Hence no data when you run it again.

    Try placing the file outside the project and point your connection string to that, see if the data persists.

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

Sidebar

Related Questions

I've got a "little" problem. A week ago my database was reaching full disk
I'm trying to troubleshoot this problem using SQL Profiler (SQL 2008). After days of
Thanks for the three excellent answers which all identified my problem of using "onclick
Problem: I have an address field from an Access database which has been converted
Problem: Given a list of strings, find the substring which, if subtracted from the
Problem I have timestamped data, which I need to search based on the timestamp
I think this is a scope problem. Since the event is triggered after I
The following is okay: try { Console.WriteLine("Before"); yield return 1; Console.WriteLine("After"); } finally {
Often I find myself interacting with files in some way but after writing the
After almost two days of searching and R&D finally I've derived some of the

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.