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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:17:28+00:00 2026-06-09T06:17:28+00:00

Hey all i am getting an odd returned value in VB.net when i try

  • 0

Hey all i am getting an odd returned value in VB.net when i try to find the highest ID number in my table:

This is my VB.net code:

    objConn = New MySqlConnection(product.strConnString)
    objConn.Open()

    strSQL = "SELECT MAX(id) FROM product;"

    Try
        objCmd = New MySqlCommand(strSQL, objConn)
        dtReader = objCmd.ExecuteReader()

        While dtReader.Read()
            nextDBID = dtReader(0)
        End While

        objConn.Close()
        objConn = Nothing
    Catch ex As Exception
        MsgBox("LoadProduct: " & ex.Message)
    End Try

When i check the value of nextDBID it comes up as 39. However, there is no 39 in the database!

When i run that exact query in mySQL GUI i get this:

select MAX(id) from fivestar_range.product;

37

My id data field is this in the product table:

37
10
11
12
7
8
6
5
4
3
2
1
13
14
36
21

I even tried using this query:

SELECT id FROM product ORDER BY ID DESC LIMIT 1;

And i still end up with 39 in the VB.net but still 37 in mySQL GUI.

What’s going on that i’m overlooking?

  • 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-09T06:17:30+00:00Added an answer on June 9, 2026 at 6:17 am

    Check your connection strings. You are likely looking at two different databases.

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

Sidebar

Related Questions

Hey all i im getting this error when trying to update a table in
Hey all i am in need of some help getting my code working correctly
Hey all, I want to change a value in a table (in a mysql
hey all. Just wanting to know is this the most efficient way of getting
Hey all i am trying to find examples of getting data back from a
Hey all i have been trying to figure out why i am getting this
Hey all, I am not quite getting why this doesn't seem to be working.
Hey all, I am trying to accomplish something very simple yet getting an error
Hey all. Here is the scenario. I have the below code, and I'm needing
hey all, just getting started on hadoop and curious what the best way in

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.