VB.Net Tutorial/Database ADO.net/SqlConnection

Материал из VB Эксперт
Перейти к: навигация, поиск

Connection string for SqlConnection

Module Module1
    Dim sConnection As String = "Password=password;Persist Security Info=True;User ID=sa;Initial Catalog=CD;Data Source=(local)"
    Sub Main()
        Dim objConn As New System.Data.SqlClient.SqlConnection(sConnection)
        Try
            objConn.Open()
        Catch myException As System.Exception
            Console.WriteLine(myException.Message)
        End Try
        Console.ReadLine()
    End Sub
End Module