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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:58:27+00:00 2026-05-13T17:58:27+00:00

I want to input data into my table (sql 2008) using linq to sql:

  • 0

I want to input data into my table (sql 2008) using linq to sql:

    public static bool saveEmail(Emailadressen email)
    {
        TBL_Emailadressen saveMail = new TBL_Emailadressen();

        destil_loterijDataContext db = new destil_loterijDataContext();


        saveMail.naam = email.naam;
        saveMail.emailadres = email.emailadres;
        saveMail.lotnummer = email.lotnummer;



        try
        {
            saveMail.naam = email.naam;
            saveMail.lotnummer = email.lotnummer;
            saveMail.emailadres = email.emailadres;

            db.TBL_Emailadressens.InsertOnSubmit(saveMail);

            return true;

        }
        catch (Exception ex)
        {
            Console.WriteLine("Opslaan niet gelukt!" + ex.ToString());
            return false;
        }

    }

For some reason nothing is being added to this table.
My table has the following fields:

ID (Auto incr int)

Naam (varchar50)

lotnummer (varchar50)

emailadres (varchar50)

My object im trying to save (saveMail) always has an ID = 0 , and i don’t know why. I think that is preventing me from saving to the DB?

  • 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-13T17:58:27+00:00Added an answer on May 13, 2026 at 5:58 pm

    Be sure to call SubmitChanges on your DataContext-derived class:

    using(var dc = new MyDataContext())
    {
        saveEmail(new Emailadressen(...));
        dc.SubmitChanges();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to input selections and input it into micropost table. The selections is
I want to insert data into a table, then if the table already has
i am trying to create a pdf email using data inputed into a html
I want to input data i.e. name and age of user on a scene
I want to send the post data from an input like this: <input type=file
I have an input edit field where the user can enter data. I want
Table A has two columns: ID and name I want to input 3 ID
I have some dirty input data that is being imported into a raw source
I have a simple application which stores the data into the sql server database
I've created a HTML and PHP form to pretty much just input data into

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.