VB.NET - Retrieve data from SQL database

Published: 20 July 2014
on channel: KnowledgeIsCool
5,810
6

Here is the code you can use to retrieve data from a SQL database.

VB.NET - Retrieve data from SQL database
-----------------------------------------------
Imports System.Data.SqlClient
Imports System.Configuration


'You can add data source to Visual Studio project and then get connection string or name from App.config file
Dim connectionString As String = ConfigurationManager.ConnectionStrings("TestProject.My.MySettings.DatabaseConnectionString").ConnectionString

Dim SQLstatement As String = "SELECT * FROM tableName"
Dim connection As New SqlConnection(connectionString)
Dim command As SqlCommand = New SqlCommand(SQLstatement, connection)
Dim adapter As New SqlDataAdapter

connection.Open()

Dim dt As New DataTable

adapter.SelectCommand = command
adapter.Fill(dt)


On this page of the site you can watch the video online VB.NET - Retrieve data from SQL database with a duration of hours minute second in good quality, which was uploaded by the user KnowledgeIsCool 20 July 2014, share the link with friends and acquaintances, this video has already been watched 5,810 times on youtube and it was liked by 6 viewers. Enjoy your viewing!