Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7083039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:07:45+00:00 2026-05-28T07:07:45+00:00

I have this stored procedure for validating login ALTER PROCEDURE ValidateUserLogin ( @UserName varchar

  • 0

I have this stored procedure for validating login

ALTER PROCEDURE ValidateUserLogin
(
@UserName varchar (50),
@Password varchar (50)
)
AS
BEGIN
if EXISTS(SELECT * FROM AdminLogin WHERE UserName=@UserName AND Password=@Password)
select 0/*returns 0 on success*/
ELSE
select 1/*non zero otherwise*/

END

and i am calling it using the code below but i get the following exception “Procedure or Function ‘ValidateUserLogin’ expects parameter ‘@UserName’, which was not supplied.”

   bool boolReturnValue = true;

    SqlCommand command = new SqlCommand();
    command.Connection = sqlConnection;
    command.CommandType = CommandType.StoredProcedure;
    command.CommandText = "ValidateUserLogin";
    command.Parameters.Add(@username,SqlDbType.VarChar,50).Value=username;
    command.Parameters.Add(@password, SqlDbType.VarChar,50).Value=password;
    sqlConnection.Open();
    try
    {
    command.ExecuteScalar();
       boolReturnValue=Convert.ToBoolean( command.ExecuteScalar());
    }
    catch (Exception ex)
    {
        Response.Write(ex.Message);
    }

and when i try to set default value for the username and password as null i get the exception
@admin is not a parameter for procedure ValidateUserLogin
//admin is the value provided for username

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:07:45+00:00Added an answer on May 28, 2026 at 7:07 am

    Change the following two lines:

    command.Parameters.Add(@username,SqlDbType.VarChar,50).Value=username;
    command.Parameters.Add(@password, SqlDbType.VarChar,50).Value=password;
    

    with:

    command.Parameters.Add("@Username",SqlDbType.VarChar,50).Value=username;
    command.Parameters.Add("@Password", SqlDbType.VarChar,50).Value=password;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this stored Proc: ALTER Procedure [dbo].[GetWebinars] ( @GroupingCode varchar(max) = 'AVM', @ItemNumber
Say I have this great query in my stored procedure. Select * from Temp
So I have this MS SQL Stored Procedure: ALTER PROCEDURE [dbo].[Import_Agent_Client_Bucket_2010] AS BEGIN --
If I have this stored proc definition minus the body ALTER PROCEDURE sp_AlloctionReport(@where NVARCHAR(1000),
I have a stored procedure and if the stored procedure does this: SELECT 0
I have a mysql stored procedure from this ( google book ), and one
I have this stored procedure, that reads data from xml and make some inserts
I have this stored procedure which get data from excell and then update status:
I have this stored procedure in my database: ALTER PROCEDURE [dbo].[sp_FTSearchLocation] @SearchFor nvarchar(200) =
I have this stored Procedure in MS SQL2008 (C#) ALTER PROCEDURE UpdateProducts @ProductID INT,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.