Visual Basic Development Bookmark and Share   
 Home > Visual Basic IDE > how to display the total number of record in a table from a database?
 

how to display the total number of record in a table from a database?

I need help with this one.I hope someone can give me an idea or basic syntax.

I have atable from a database andi need to display the total number of record and display it in a label.

i already have binding navigator but i will not use to display the total number of record in that table. and i will also make that binding navigator invisible.

thank u!

cotoy  Tuesday, December 01, 2009 12:29 AM
if you are reading the database table into an in-memory datatable, you can just use the DataTable.Rows.Count property

my in-memory table is named dtTest


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Label1.Text = dtTest.Rows.Count.ToString & " Records"
    End Sub
  • Marked As Answer bycotoy 21 hours 14 minutes ago
  •  
jwavila  Tuesday, December 01, 2009 12:53 AM
if you are reading the database table into an in-memory datatable, you can just use the DataTable.Rows.Count property

my in-memory table is named dtTest


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Label1.Text = dtTest.Rows.Count.ToString & " Records"
    End Sub
  • Marked As Answer bycotoy 21 hours 14 minutes ago
  •  
jwavila  Tuesday, December 01, 2009 12:53 AM
Hello Jwavila

This code works perfectly for me. Thank u very much.

I'd like to ask to which guide or msdn section i can find this some help.

Again Thank u very much!
cotoy  21 hours 12 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• 2008 Solution Explorer Focus colors
• "Save as"
• Is it Possible to have Regions with in a function
• extending Intellisense for format that is semi XML semi C#
• Could not load file or assembly in windows
• "object reference not set to an object" when starting a project in vs2008
• IDE Font Options Gone
• Help reading xml data into my application
• visual basic ide+compiler is a mess!
• Refactor! question