This looks like it should be so simple, but ... When I set a value in my 2nd parameter I get an error, 3421, telling me that my "value is the wrong type".
This is my table:
CREATE TABLE [dbo].[Emails]
(
[Id] INT NOT NULL PRIMARY KEY IDENTITY,
[ManagerList] BIT NOT NULL,
[FixtureList] BIT NOT NULL,
[Shomatch] BIT NOT NULL,
[Newsletter] BIT NOT NULL,
[Turn] BIT NOT NULL,
[Started] BIT NOT NULL,
[Sent] BIT NOT NULL,
[Acknowledged] BIT NOT NULL,
[League] INT NOT NULL,
CONSTRAINT [FK_Emails_League] FOREIGN KEY ([League]) REFERENCES [Leagues]([Id])
)
This is my stored procedure :
CREATE PROCEDURE [dbo].[UpdateEmails]
@pLeagueId INT,
@pFixtureList BIT
AS
UPDATE [dbo].[Emails]
SET [FixtureList] = @pFixtureList
WHERE [League] = @pLeagueId;
This is my code :
Option Explicit
Option Base 1
Option Compare Text
Sub UpdateEmailsFixtureList()
Set KA_Com = New ADODB.Command
KA_Com.CommandText = "UpdateEmails"
KA_Com.CommandType = adCmdStoredProc
Set KA_Parameter = KA_Com.CreateParameter(Name:="pLeagueId", Type:=adInteger)
KA_Com.Parameters.Append KA_Parameter
KA_Com.Parameters("pLeagueId").Value = KA_RS_Leagues![ID]
Set KA_Parameter = KA_Com.CreateParameter(Name:="pFixtureList", Type:=adBinary, Size:=1)
KA_Com.Parameters.Append KA_Parameter
KA_Com.Parameters("pFixtureList").Value = 1 <<< ERROR 3421 on this line
Set KA_RS_Leagues = KA_Com.Execute
End Sub
Thanks for your help, I can't understand how something that looks so simple can be so stubborn !