| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 
 | Imports System.Data.SqlClient
Imports System.Console
Imports Microsoft.VisualBasic.ApplicationServices
 
Module Module1
 
    Dim myConnection As SqlConnection
    Dim myCommand As SqlCommand
    Dim dr As SqlDataReader
 
    Sub Main()
 
 
 
        Try
 
 
 
 
 
            myConnection = New SqlConnection("connection parameters;")
            'you need to provide password for sql server
            myConnection.Open()
            myCommand = New SqlCommand("SELECT * FROM [account_user] WHERE [genacc_user_adacc] = 'System.Environment.UserName', myConnection)
            dr = myCommand.ExecuteReader
            Do
                While dr.Read()
 
                    WriteLine(dr(7))
                    WriteLine(dr(8))
                    ' writing to console
                End While
            Loop While dr.NextResult()
        Catch
        End Try
        dr.Close()
        myConnection.Close()
 
 
 
 
    End Sub | 
Partager