So I have a stored procedure with these parameters:
ALTER PROCEDURE [dbo].[usp_insertOrUpdateTimeMilesNote]
@id int,
@ADID varchar(10),
@projectId int,
@taskId tinyint,
@hours tinyint = 0,
@minutes tinyint = 0,
@miles smallint = 0,
@note varchar(max),
@filename varchar(50),
@MSVCFlag bit
AS
And I'm calling it like so:
Using db As New SqlCommand("usp_insertOrUpdateTimeMilesNote", New SqlConnection(ConnStr))
db.CommandType = CommandType.StoredProcedure
db.Parameters.Add("@id", SqlDbType.Int).Value = 0
db.Parameters.Add("@ADID", SqlDbType.VarChar, 10).Value = ADID
db.Parameters.Add("@projectId", SqlDbType.Int).Value = ProjectId
db.Parameters.Add("@taskId", SqlDbType.Int).Value = 0
db.Parameters.Add("@hours", SqlDbType.TinyInt).Value = 0
db.Parameters.Add("@minutes", SqlDbType.TinyInt).Value = 0
db.Parameters.Add("@miles", SqlDbType.TinyInt).Value = 0
db.Parameters.Add("@Note", SqlDbType.VarChar, -1).Value = NoteText
db.Parameters.Add("@filename", SqlDbType.VarChar, 50).Value = ""
db.Parameters.Add("@MSVCFlag", SqlDbType.Bit).Value = 1
db.Connection.Open()
db.ExecuteNonQuery()
db.Connection.Close()
End Using
In the target table, the MSVCFlag column is always 0 even though I set the parameter's value to 1.
If I do it as a string, it works fine.
"EXEC usp_insertOrUpdateTimeMilesNote " & id & ",'" & ADID & "'," & projectId & "," & taskId & "," & hours & "," & minutes & "," & miles & ",'" & note & "','" & filename & "'," & MSVCFlag & ";"
So what am I doing wrong with the parameter?
EDIT: Love the down vote. Mind explaining why?