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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:16:39+00:00 2026-06-14T21:16:39+00:00

I have a Visual Basic project using Access database.I run a query but i

  • 0

I have a Visual Basic project using Access database.I run a query but i don’t see any new data on my database table.I don’t have any exception or error.Instead of this the success messagebox is shown.
Here is my code:

    Dim ID As Integer = 2
    Dim TableNumber As Integer = 2
    Dim OrderDate As Date = Format(Now, "General Date")
    Dim TotalPrice As Double = 100.0
 Dim ConnectionString As String = "myconnectionstring"
    Dim con As New OleDb.OleDbConnection(ConnectionString)


    Try
        Dim InsertCMD As OleDb.OleDbCommand

        InsertCMD = New OleDb.OleDbCommand("INSERT INTO Orders([ID],[TableNumber],[OrderDate],[TotalPrice]) VALUES(@ID,@TableNumber,@OrderDate,@TotalPrice);", con)
        InsertCMD.Parameters.AddWithValue("@ID", ID)
        InsertCMD.Parameters.AddWithValue("@TableNumber", TableNumber)
        InsertCMD.Parameters.AddWithValue("@OrderDate", OrderDate)
        InsertCMD.Parameters.AddWithValue("@TotalPrice", TotalPrice)

        con.Open()
        InsertCMD.ExecuteNonQuery()
        MessageBox.Show("Successfully Added New Order",
                        "Success", MessageBoxButtons.OK, MessageBoxIcon.Information)
        con.Close()
    Catch ex As Exception
        'Something went wrong
        MessageBox.Show(ex.ToString)
    Finally
        'Success or not, make sure it's closed
        If con.State <> ConnectionState.Closed Then con.Close()
    End Try

What is the problem?

  • 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-14T21:16:40+00:00Added an answer on June 14, 2026 at 9:16 pm

    One of two things is happening: Either the data is not getting updated, or it’s getting updated and you’re missing it when you look for it afterward. ExecuteNonQuery normally returns the number of rows acted on. If it’s zero, then it’s possible it’s failing without an exception. This might have something to do with a duplicate ID.

    If it’s inserting successfully, then you aren’t seeing the new record for some reason. Maybe you’re looking in the wrong place, or maybe the record isn’t turning up in a query for some reason. I don’t know of anything with “on duplicate update” by default, but if Access has that it could cause the problem.

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

Sidebar

Related Questions

I am using Microsoft Visual Basic 2010 Express. I have a WPF-based project. I
My project is using Visual Basic 2010. I have a pure text save file
I am using visual basic for coding. In my form I have a delete
I have written a basic Application for windows mobile 5. It is using visual
I have been working on getting a basic ATL project to compile in Visual
I have encountered an unexpected Access Error while running a project I've built using
I am using VB.NET 2010 (Visual Basic 2010 Express) on a WPF-based project. I
I am using visual studio 2010 and believe I have a project settings issue.
I'm trying to create a Setup using Visual Studio Setup Project. A mistake, but
I am using Visual Basic 6. There are some component references in my project.

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.