Nailed it. was thanks to the
Cmd.CommandType = CommandType.StoredProcedure
pointer
Thanks for the help and pointers much appreciated
New code
Public Function updateVisitors(ByVal VPCode As String)
Dim conn As New System.Data.SqlClient.SqlConnection(access.SQLstrconn)
Dim sql As String = "UPDATE_SiteVisitors2"
Dim Cmd As New System.Data.SqlClient.SqlCommand(sql, conn)
Cmd.CommandType = CommandType.StoredProcedure
Cmd.Parameters.Add("@VPCode", SqlDbType.VarChar, 10, ParameterDirection.Input).Value = VPCode
Cmd.Parameters.Add("@Exists", SqlDbType.Int)
Cmd.Parameters("@Exists").Direction = ParameterDirection.Output
conn.Open()
Cmd.ExecuteNonQuery()
SignIn.exists = Cmd.Parameters("@Exists").Value
conn.Close()
MsgBox(SignIn.exists)
Return SignIn.exists
End Function
SQL slightly changed
alter PROCEDURE UPDATE_SiteVisitors2
@VPCode nvarchar(10),
@Exists INT OUTPUT
AS
BEGIN
SET NOCOUNT ON;
IF EXISTS (select vpcode FROM SiteVisitors WHERE vpcode=@vpcode)
BEGIN
update sitevisitors
set
VSignOut = getdate()
where VPCode=@VPCode
set @Exists = 1
END
ELSE
BEGIN
set @Exists = 0
END
RETURN @Exists
END