Can someone please tell me why the results of my query are not appearing in my console application? I have a feeling it is something wrong with the console.writeline or readline

Imports System.Data
Imports System.Data.SqlClient

Module Module1

    Private Property Sql As String

    Sub Main()
        Dim ConnString As String = "Data Source=;Initial Catalog=AddressStagingTable;Persist Security Info=True;User ID=sa;Password=JFK9j0b"

        Using Con As New SqlConnection(ConnString)
            Sql = "Insert into Address(streetname) values(@streetname)"
            Dim cmd1 As New SqlCommand(Sql, Con)
            cmd1.Parameters.Add("@streetname", SqlDbType.VarChar, 22)
            cmd1.Parameters("@streetname").Value = "KENTUCKY ST N"
            'Insert New Record
            cmd1.Parameters("@streetname").Value = "SMITH ST N"
            'Read Records

            Sql = "select * from address where itemtype = 'R2' "
            Dim cmd As New SqlCommand(Sql, Con)
        End Using

    End Sub

End Module

Use a reader

dim reader as sqldatareader = cmd.executereader
do while

What if I wanted to view all columns in the following query: select * from address where itemtype = 'R2'

I don't know what your columns are but all columns you select in the query can be accessed in the reader like above.

Console.writeline(reader("StreetName") & " " & reader("streetNumber") & " " & reader("State"))

This question has already been answered. Start a new discussion instead.