Stored procedure executes fine if executed in SQL Server Management Studio.
In C# (Winforms) I have the following code:
InsertWarning.Parameters.AddWithValue("@idUser", userIDAuth);
InsertWarning.Parameters.AddWithValue("@idPass", idPass);
if (Privileged)
MessageWarning += " gave you privileged access to note " + Description;
else
MessageWarning += " gave you access to note " + Description;
InsertWarning.Parameters.AddWithValue("@Message", MessageWarning);
InsertWarning.ExecuteNonQuery();
InsertWarning.Parameters.Clear();
When ExecuteNonQuery()
runs it stops saying the @idUser
has no value.
Stored procedure in C#:
SqlCommand InsertWarning = new SqlCommand("_spInsertWarnings", TeamPWSecureBD);
InsertAuths.CommandType = CommandType.StoredProcedure;
Stored procedure in SQL:
[dbo].[_spInsertWarnings]
@idUser int, @idPass int, @Message nvarchar(MAX)
AS
INSERT INTO Warnings
VALUES(@idUser, @idPass, @Message)