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 8831367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:17:38+00:00 2026-06-14T08:17:38+00:00

OpenSqlConnection(); SqlCommand cmd = new SqlCommand(ReturnCharacterInfo, Con); cmd.Parameters.AddWithValue(@CharacterID, CharacterID); SqlDataReader dr = cmd.ExecuteReader(); When

  • 0
OpenSqlConnection();

SqlCommand cmd = new SqlCommand("ReturnCharacterInfo", Con);
cmd.Parameters.AddWithValue("@CharacterID", CharacterID);

SqlDataReader dr = cmd.ExecuteReader();

When I run code you can see above, it throws exception

Procedure or function ‘ReturnCharacterInfo’ expects parameter ‘@CharacterID’, which was not supplied.

but as you can see at the code, I’m suppying @CharacterID parameter and it’s not empty or null.

Stored procedure:

    [ReturnCharacterInfo] @CharacterID int 
as
   select 
      CharacterName, characterSurname, CharacterIsMale, CharacterAge, 
      CharacterMood, CharacterHealth, CharacterInCity, CharacterInLocation, 
      Cities.CityName, Locales.LocaleTitle 
   from 
      Characters 
   INNER JOIN 
      Cities on Cities.CityID = Characters.CharacterInCity
   INNER JOIN 
      Locales on Locales.LocaleID = Characters.CharacterInLocation
   Where 
      CharacterID = @CharacterID

Any suggestions?

  • 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-06-14T08:17:40+00:00Added an answer on June 14, 2026 at 8:17 am

    I would try to explicitly specifying the type of the parameter – especially important if the value is null:

    SqlCommand cmd = new SqlCommand("ReturnCharacterInfo", Con);
    
    // added as per CodeNaked's comment - thanks! You've nailed it right on the head!
    cmd.CommandType = CommandType.StoredProcedure;
    
    cmd.Parameters.Add("@CharacterID", SqlDbType.Int).Value = CharacterID;
    

    Also: do you have a typo anywhere?? Triple-check all occurrences of CharacterID – do you happen to have CharachterID or something like that somewhere in your code??

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's wrong with this code ? I always get a Object synchronization method was
I have the following code that uses Sequence objects to read data from a
I'm writing a code generator and am getting stuck on determining the nullable status
I found this code on the MSDN site here http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.open.aspx : private static void
If methods/functions I'm going to call involve the need of an open SqlConnection, I
I'm learning about classes in C# and am trying to build a DataAccessClass. I
I am just learning how to use classes in my projects. I have been
Description of my problem sounds somewhat complicated, what makes me think that my approach
My job seems to be hanging when opening an SQL connection. An example that
This one is tough to explain inside the title. What I have going on

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.