
Only sa Connects using SQLOLEDB provider
The code below seems to work only when the login Id is "sa". I am not able
to get a connection with a regular user. The server in question has only
users authenticated through NT. So, technically, "sa" shouldn't be able to
log in from a client, since we have no NT user called "sa".
The user I am trying to connect with has full permissions (dbo) in the pubs
database. Those permissions are by way of an NT Group mapped to a db role.
By the way, the exact same situation occurs when going through Crystal
Reports using Server Type:
OLEDB - SQLOLEDB - Microsoft OLE DB Provider for SQL Server
Only "sa" can get a connection.
Anyone have an idea what the solution is to this security/connectivity
issue?
The code:
(Extracted from Otey & Conte's SQL Server 7 Developer's Guide,
Osborne/McGraw Hill)
Dim cn As New ADODB.Connection
' Use the global connection object - cn
' Connect using the OLE DB provider for SQL Server - SQLOLEDB
cn.ConnectionString = "PROVIDER=SQLOLEDB" & _
";SERVER=" & txtServer & _
";UID=" & txtLoginId & _
";PWD=" & txtPassword & _
";DATABASE=pubs"
cn.Open
cn.Close