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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:22:42+00:00 2026-05-23T20:22:42+00:00

I have an sqldatasource that takes a stored procedure with a parameter..But that the

  • 0

I have an sqldatasource that takes a stored procedure with a parameter..But that the stored procedure doesnt get executed…

Am I passing the parameter successfully?

SQLDataSource:

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CP_AllQuestionsAnswered %>" 
        SelectCommand="GetMessagesTitles" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter Name="Name" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

The pageLoad code behind:

  string name = ModeratorUsefulFunctions.GetMessageUsersName(g);
    SqlDataSource1.SelectParameters.Add("@Name", name);

The stored procedure:

    ALTER PROCEDURE dbo.GetMessagesTitles

   @Name nvarchar(50)

AS
    SELECT MessageTitle, MessageID
    FROM Messages
    WHERE MessageTo=@Name 
  • 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-23T20:22:43+00:00Added an answer on May 23, 2026 at 8:22 pm

    You need to pass the parameters value instead of adding the parameter in the SQLDataSource. Since you have already added the parameter in the SelectParameters Collection, you only need to pass the value. The way you are doing, it adds another Select parameter, that’s the problem.

    It should be like..

    string name = ModeratorUsefulFunctions.GetMessageUsersName(g);
    
    SqlDataSource1.SelectParameters["name"].DefaultValue = name;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a stored procedure that i tested directly and it works, but when
I have a SQLDataSource that is bound to a ListView control but I want
I have a gridview which uses a stored procedure with session[UserName] as a parameter
I have a SqlDataSource that calls a stored proc. When the page loads a
So, I have a GridView , CustomerGridView, and a SqlDataSource , SqlDataSource1, that pulls
I have a sqldatasource connection in whose parameters, the insert parameter is set as
I have a page in asp.net (web forms) that up until now only had
I have a CommandArgument that takes in 1 argument from a LinkButton in my
I have JavaScript code that calls a method in ASP.NET. Basically, I have a
In code that I inherited, I have a SqlDataSource that has a fairly complex

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.