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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:10:08+00:00 2026-06-03T07:10:08+00:00

I am getting this error while inserting data using linq. In this i have

  • 0

I am getting this error while inserting data using linq. In this i have a table which has two columns one is identity column and another is nullable marquee txt. Please provide solution.
My Code is here .

   protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            Marquee existing = context.Marquees.FirstOrDefault();
            if (existing != null)
            {
                 existing.marquee1 = txtMarquee.Text;
                 context.SubmitChanges();
                 lblmsg.Text = "Data Saved Successfully";
                 generalFunction.goGreen(lblmsg);
            }
            else
            {
                Marquee newMarquee = new Marquee();
                 newMarquee.marquee1 = txtMarquee.Text;
                context.Marquees.InsertOnSubmit(existing);
                context.SubmitChanges();
                lblmsg.Text = "Data Saved Successfully";
                generalFunction.goGreen(lblmsg);
            }
        }
        catch (Exception ee)
        {
            lblmsg.Text = "Error: " + ee.Message;
        }
    }
  • 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-06-03T07:10:10+00:00Added an answer on June 3, 2026 at 7:10 am

    You really need to give more information. A little hard to tell because of the lack of information, but you’ve created newMarquee but then you’ve passed existing into the InsertOnSubmit function. I don’t know where existing came from since its not in the code, but perhaps that’s null and that’s why you’re getting this error?

    You say you edited your code, but the problem still exists in what you’re showing: In the “else” section, existing is null, and so when you pass it into InsertOnSubmit it’s probably throwing an error. InsertOnSubmit will throw that exact error when that is null. You want that line to be context.Marquees.InsertOnSubmit(newMarquee); instead.

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

Sidebar

Related Questions

I am getting strange error while inserting data into mysql table column. Details: Create
I am getting this error while inserting in my table: A Database Error Occurred
I am using zendgdata library for google calendar. I am getting this error while
I am getting this error while using twitter bootstrap. I didn't get this error
I'm getting this error while running tomcat 'java.lang.ClassNotFoundException: com.mysql.jdbc.Driver'. I'm using a combination of
I'm getting this error while working on map (Drawing line on map using GetDirection
I'm getting this strange error while processing a large number of data... Error Number:
I am getting this error while running my app on the device.I have installed
getting this error while linking an app, some one an idea? ld: duplicate symbol
I am getting this error while verifying my Structuremap configuration using container.AssertConfigurationIsValid() in my

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.