1. Windows Authentication
2. SQL Authentication
You need to enable SQL Authentication or Mixed mode authentication to login using sql user name and password.
Here's an example of how to connect to server using vb .net using sql authentication mode.
Public mUserId As String
Public sUserId As String = "sa"
Public sPassWord As String = "sa123"
Public sDatabase As String = "CampusIndya"
Public sServer As String = "MURUGAN\SQLEXPRESS"
Public Sub GetConnection()
If MyConnection.State = ConnectionState.Closed Then
MyConnection.ConnectionString = "User ID=" & sUserId & ";Password=" & sPassWord & ";database=" & sDatabase & " ;server=" & sServer
End If
End Sub
|