I have a VB6 application that is currently using MSDASQL as the provider with ADO. I am looking to start using the newer MSOLEDBSQL provider. All is well and I can connect to my database however if I try to execute a stored procedure which return a
value I am not getting any return values in my recordset.
I have included both my code and the stored procedure below.
Has anyone else come across this issue as I am struggling to find any info on the net.
Stored Procedure:
Create Procedure [dbo].[InsertRecUserLogonAudit]
@UserLogOnApp VarChar(50),
@UserLogOnDate DateTime,
@UserLogOnUserID VarChar(50),
@UserLogOnPassword VarChar(50),
@UserWindowsName VarChar(255),
@UserPCName VarChar(255),
@UserLogOnMsg Text,
@UserLogOffDate DateTime As
Declare @ChangeTime Datetime
Declare @LogCode Decimal(9,0)
Set @ChangeTime = GetDate()
Insert Into UserLogonAudit(UserLogOnApp, UserLogOnDate, UserLogOnUserID, UserLogOnPassword, UserWindowsName, UserPCName, UserLogOnMsg, UserLogOffDate)
Values(@UserLogOnApp, @UserLogOnDate, @UserLogOnUserID, @UserLogOnPassword, @UserWindowsName, @UserPCName, @UserLogOnMsg, @UserLogOffDate)
Set @LogCode = (Select @@Identity)
Select @LogCode
GO
VB6 Code:
SysConnectionString = "Provider=MSOLEDBSQL; Driver={SQL Server}; DataTypeCompatibility=80; Server=" & SysServer & "; Database=" & SysDatabase & "; UID=TTExe; PWD=" & SysTTExePassword$ & ";
adoConnectAudit.CommandTimeout = 120
adoConnectAudit.Open SysConnectionString
' Create logon audit record, get last identity value
SQLCmd = SQLCmd & "Execute InsertRecUserLogonAudit "
SQLCmd = SQLCmd & "'" & App.Title & "', {ts'" & Format$(Now, "yyyy-mm-dd hh:mm:ss") & "'}"
SQLCmd = SQLCmd & ", '" & UserID & "', '" & SysEncrypt.EncodeString(PassWord) & "'"
SQLCmd = SQLCmd & ", '" & GetThisUserName & "', '" & GetThisComputerName & "', '', Null" & vbCrLf '
Set adoResult = adoConnectAudit.Execute(SQLCmd)
SysLogonAuditRecord = adoResult.Fields(0)