|
The ProgrammingMSAccess.COM Site This procedure demonstrates how to connect to a sql server database with a windows account. Private Sub Button1_Click(ByVal sender As System.Object, _ByVal e As System.EventArgs) Handles Button1.Click
'Declare, instantiate, and open a connection Dim cnn1 As SqlClient.SqlConnection = _New SqlClient.SqlConnection("Data Source=CCS1;" & _ "Initial Catalog=HCVB;Integrated Security=SSPI") Try cnn1.Open() MsgBox("Connection opened successfully.") Catch ex1 As SqlClient.SqlException MsgBox(ex1.Message) Finally cnn1.Close() End Try End Sub
Learn more about VB.NET programming from either Programming Microsoft SQL Server 2000 with Microsoft Visual Basic .NET or Programming Microsoft Visual Basic .NET for Microsoft Access Databases. Copyright 2003 CAB, Inc. All rights reserved. Republication or redistribution
of CAB, Inc. content, including by framing or similar means, is expressly
prohibited without the prior written consent of CAB, Inc. CAB, Inc. shall not be
liable for any errors in the content, or for any actions taken in reliance
thereon.
|