Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored Proc doesn't recognize parameter as being passed
Message
From
25/05/2023 11:37:02
 
 
To
All
General information
Forum:
C#
Category:
Databases
Title:
Stored Proc doesn't recognize parameter as being passed
Miscellaneous
Thread ID:
01686613
Message ID:
01686613
Views:
37
Never mind - found the issue


Got a login page I'm working on in a Blazor app.

This is the code (or part of it):
		using (SqlConnection myconn = new SqlConnection(ResConn))
		{
			string userproc = "ISYSUserLookup";
			using (SqlCommand rescmd = new SqlCommand(userproc, myconn))
			{
        myconn.Open();

				rescmd.Parameters.AddWithValue("@UserID", creds.UserID);  // this is the only imput param.
	
				SqlParameter PssWord = new SqlParameter("@password", SqlDbType.VarChar, 200);
				PssWord.Direction = ParameterDirection.Output;
				rescmd.Parameters.Add(PssWord);

				SqlParameter SaltVal = new SqlParameter("@Salt", SqlDbType.VarChar, 25);
				SaltVal.Direction = ParameterDirection.Output;
				rescmd.Parameters.Add(SaltVal);

				SqlParameter PRD = new SqlParameter("@PWResetDays", SqlDbType.Int);
				PRD.Direction = ParameterDirection.Output;
				rescmd.Parameters.Add(PRD);

				SqlParameter AC = new SqlParameter("@AccessLevel", SqlDbType.Int);
				AC.Direction = ParameterDirection.Output;
				rescmd.Parameters.Add(AC);

				SqlParameter Deact = new SqlParameter("@Deact", SqlDbType.Int);
				Deact.Direction = ParameterDirection.Output;
				rescmd.Parameters.Add(Deact);

				int GetCreds = rescmd.ExecuteNonQuery();
				myconn.Close();
At the ExecuteNonQuery, I get "stored proc ProcName is expected the parameter @UserID which was not supplied"
** by the by, this is the parameter block for the stored proc
ALTER PROCEDURE [dbo].[ISYSUserLookup]
	@UserID varchar(50),
	@password varchar(200) output,
	@Salt varchar(25) output,
	@PWResetDays int output,
  @AccessLevel int output,
  @Deact int output
as
When stepping through the code, VS tells me that yes, @UserID is the first item in the parameter array and it even has the value for it, so I know it's getting that far.
SQL Profiler tell me nothing cuz it's not getting that far.

Has anyone seen this before?
Suggestions where to look?
Anyone?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Next
Reply
Map
View

Click here to load this message in the networking platform