Skip to content

Instantly share code, notes, and snippets.

@appforest
Created September 17, 2013 04:13
Show Gist options
  • Save appforest/6590004 to your computer and use it in GitHub Desktop.
Save appforest/6590004 to your computer and use it in GitHub Desktop.
Imports System.Data.SqlClient
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using connection As New SqlConnection("Data Source=***SQL-SERVER-LOCATION***;Initial Catalog=***DB-NAME***;Integrated Security=True")
connection.Open()
Dim command As New SqlCommand("SELECT * FROM ***TABLE-NAME***", connection)
Dim reader As SqlDataReader = command.ExecuteReader()
While reader.Read()
Console.WriteLine("{0}", reader(0) & reader(1) & reader(2)) ''Depending on number of rows
End While
End Using
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment