Vb.Net Select Data From Sql Server DataBase

Visual Basic .Net - How To Dispaly Data From SqlServer DataBase To DataGridView 

                                                                                                                         

In This VB.NET Tutorial We Will See How To Show Microsoft SQL DataBase Records In Datagridview Using Visual Basic .NET Programming Language.


Project Source Code:

Imports System.Data.SqlClient

Public Class vbnet_and_sql_select_data
    Dim connection As New SqlConnection("Server= SAMSNG-PC; Database = TestDB; Integrated Security = true")

    Private Sub vbnet_and_sql_select_data_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        Dim adapter As New SqlDataAdapter("SELECT * FROM Users", connection)

        Dim table As New DataTable()

        adapter.Fill(table)

        DataGridView1.DataSource = table



    End Sub
End Class

///////////////OUTPUT:

vb.net fill datagridview from sql server database







Share this

Related Posts

Previous
Next Post »