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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:46:59+00:00 2026-05-17T06:46:59+00:00

I have searched, but nothing happens, I just starting using C#.NET and I a

  • 0

I have searched, but nothing happens, I just starting using C#.NET and I a have a textbox on a form. I retrieve some data from the database and I display to a textbox through a combobox that indicate the section I want to display (I already do this!),but when I try to update nothing works, I click my button to update the access database(Access 2007) and nothing happens, the user just changes something and the button has to update the acces database, I hope you can help me 😀
this is my code so far:

        String textTobeUpdated = textBox3.Text;
        String thing = comboBox2.Text;




        using (var conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=MyDataBase.accdb"))

        using (var cmd = conn.CreateCommand())
        {


            cmd.CommandText = "UPDATE Section SET content = [@content] WHERE name= thing";
            cmd.Parameters.AddWithValue("@content",content);


            conn.Open();



            int rowsAffected = cmd.ExecuteNonQuery();
            if (rowsAffected == 1)
            {
                MessageBox.Show("Success");
            }
            else
            {
                MessageBox.Show(string.Format("{0} Rows Affected", rowsAffected));
            }

this code display a message that tells “Unhandled exception. If click in continue, the application will omit this error and intent continue. If click in exit, the application will close immediately” The are no especified value for some of the required parameters.

  • 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-17T06:47:00+00:00Added an answer on May 17, 2026 at 6:47 am

    Looks like you execute the query twice (two areas where you call cmd.ExecuteNonQuery(); )

    Remove the first one and leave the line that says

    int rowsAffected = cmd.ExecuteNonQuery(); 
    

    This line will perform the update, then count how many rows were updated. This count is then used to display a message to the user.

    You’re also not setting the content variable with a value, (I guess it should be the textbox value), and the update query itself seems a little odd, you haven’t parameterised the ‘thing’ you’re updating, so I guess it should be:

    cmd.CommandText = "UPDATE Section SET content=[@content] WHERE name=[@thing]"; 
    cmd.Parameters.AddWithValue("@content", textTobeUpdated);
    cmd.Parameters.AddWithValue("@thing", thing);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this is a newbie question. I have searched but found nothing... Using
I have searched for a CGI and read about it but nothing useful found.
Yes, I have searched and tried many techniques, but nothing seems to work. Here
I have already googled and searched stackoverflow but I can find nothing related to
I have searched the knowledge base high and low, but nothing seems to give
I have a very simple question (I searched on google but found nothing). How
I have searched for similar issues but I found nothing... I have a problem
I have searched but can't find why this simple code will fail in Drools
I have searched but could not find the reason for this behavior. I have
I have searched but have not found my answer. Disclaimer: I am brand new

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.