I am at a loss here, I don't understand why the procedure is not getting this parameter...
Procedure (procInfoColor):
ALTER PROCEDURE [dbo].[procInfoColor]
(@ID int)
AS
BEGIN
SELECT Id, Code, [Description], IsActive FROM tblColor WHERE Id = @ID
END
VB.Net code:
Public Function infoColor(ID As Integer) As List(Of Colors) Implements iMaintenance.infoColor
Dim p = New DynamicParameters()
p.Add("@ID", ID, DbType.Int32)
Try
Return DbConn.Query(Of Colors)("procInfoColor", p, Nothing, 60, CommandType.StoredProcedure).ToList()
Catch ex As Exception
End Try
End Function
SQL Trace command (Text Data) - Command is generated by the VB.NET procedure call:
exec sp_executesql N'procInfoColor',N'@ID int',@ID=9
Error:
Msg 201, Level 16, State 4, Procedure procInfoColor, Line 2 Procedure or function 'procInfoColor' expects parameter '@ID', which was not supplied.
I can run this just fine when executing the procedure through a right click, but when I call the procedure from my VB.Net application I am getting this error message stating @ID is not being supplied. I checked the SQL trace and it sure looks like it is being supplied to me?
Any help at all would be appreciated.
cmdas your sql command then you would need to add it withcmd.Parameters.Add("@ID", SqlDbType.Int).Value = IDagain assuming you have declared ID as integer etcdim ID as integer = 1- Chickensp_executesql, but not toprocInfoColor. The correct trace would beexec sp_executesql N'procInfoColor @ID',N'@ID int',@ID=9. - GSerg