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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:20:23+00:00 2026-06-08T14:20:23+00:00

I am new in vb.NET and SQL. I want to view the latest input

  • 0

I am new in vb.NET and SQL. I want to view the latest input in my vb.NET program. How would I do it? Where bed number is auto-increment. Currently, this do record the changes in the database but when I want to view the details the label remains empty which it should be.

This is my code:

 Dim SQLStatement As String = "SELECT name, age, date_of_confinement,type_of_sickness, " _
                              "type_of_IV_fluid, number_of_bottles, drop_rate " _
                              "FROM patient WHERE bednumber=1"

    Dim cmd As MySqlCommand = New MySqlCommand

    With cmd
        .CommandText = SQLStatement
        .CommandType = CommandType.Text
        .Connection = SQLConnection
        .ExecuteNonQuery()

        '--read the records in database in phpmyadmin gui---
        Dim myReader As MySqlDataReader = cmd.ExecuteReader
        If myReader.Read Then
            ViewInfo.lblName.Text = myReader.GetString(0)
            ViewInfo.lblAge.Text = myReader.GetString(1)
            ViewInfo.lblDate.Text = myReader.GetString(2)
            ViewInfo.lblSickness.Text = myReader.GetString(3)
            ViewInfo.lblFluid.Text = myReader.GetString(4)
            ViewInfo.lblBottle.Text = myReader.GetString(5)
            ViewInfo.lblDrop.Text = myReader.GetString(6)

            myReader.Close()
        End If
    End With

Thanks!

  • 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-08T14:20:25+00:00Added an answer on June 8, 2026 at 2:20 pm

    Try to change the SQL statement in this way:

     Dim SQLStatement As String = "SELECT TOP 1 name, age, date_of_confinement,type_of_sickness, " _ 
                                  "type_of_IV_fluid, number_of_bottles, drop_rate " _ 
                                  "FROM patient ORDER BY bedumber DESC" 
    

    This will sort the patient table on bednumber in descending order (so the last inserted record is on top) then get this first record (TOP 1).

    Of course I suppose that bednumber is a numeric column with values autogenerated sequentially by the database in rough order of insertion.

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

Sidebar

Related Questions

I'm new at LINQ, searching the net for LINQ samples that mimic SQL's LIKE
I am new to .NET and ideally want to make several layers of abstraction
I am new to .net MVC structure. I am trying to create Partial view
I am new to asp.net. I have a details view control on my page.
I'm building a new .NET 4.0 ASP.NET MVC3 application and currently the database is
I'm using ASP.net membership system with SQL Server 2000 database. What I want to
I am using Razor view engine in ASP.Net MVC 3 RC 2. This is
I am new to asp.net and I am trying to learn Linq to SQL.
I have just started a new web application with asp.net mvc and sql server
I'm just starting a new project on ASP.NET MVC and this will be the

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.