Connection without User Name and Password
Imports System
Imports System.Data
Imports System.Data.SqlClient
Module Connection_Sql
Sub Main()
Dim connString As String = "server=(local)\SQLEXPRESS; " & _
"integrated security=true;"
Dim conn As New SqlConnection(connString)
Try
conn.Open()
Console.WriteLine("Connection Opened")
Catch ex As SqlException
Console.WriteLine("Error: " & ex.ToString())
Finally
conn.Close()
Console.WriteLine("Connection Closed")
End Try
End Sub
End Module
Related examples in the same category