Connection without User Name and Password : SQL Server Connection String « Database ADO.net « VB.Net






Connection without User Name and Password

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

1.SqlConnection Connection String for SQL server ExpressSqlConnection Connection String for SQL server Express