I've been using SQL authentication for years in my code and checking the recordcount of a select stored procedure would correctly return the number of records in the underlying query statement. I am now trying to use Windows authentication to connect to the database, but the recordcount property for the same code is returning -1. How can I get it to return the correct recordcount?
Here is my original connection string that works:
Provider=MSDataShape.1;Persist Security Info=True;Data Source=LBAPP1;User ID=sa;Password=MyPassword;Initial Catalog=MyDatabase;Data Provider=SQLOLEDB.1
Here is new trusted connection string:
Provider=SQLOLEDB;Data Source=LBApp1;Initial Catalog=MyDatabase;Trusted_connection=yes;
Here is the code that I'm running:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
cn.ConnectionString = strDBConnection
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "qdfSiteLogin"
cmd.Parameters(1) = strLoginComputer
Set rs = cmd.Execute
If rs.RecordCount > 0 Then