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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:27:28+00:00 2026-05-28T13:27:28+00:00

This will work. SelectCommand=SELECT [CompanyName], [Country] FROM [Customers] WHERE ([Country] = ?)> <SelectParameters> <asp:Parameter

  • 0

This will work.

SelectCommand="SELECT [CompanyName], [Country] FROM [Customers] WHERE ([Country] = ?)">
    <SelectParameters>        
       <asp:Parameter DefaultValue="Mexico" Name="Country" Type="String" />        
    </SelectParameters>

But this won’t work. It will give “Incorrect syntax near ‘?’.” error message.

SelectCommand="EXEC Docs.[DocumentList] @UserName = ?, @Service = ?, @YearGroup = ?, @Category = ?">
<SelectParameters>
   <asp:Parameter DefaultValue="8882074" Name="UserName" />
   <asp:Parameter DefaultValue="9" Name="Service" />
   <asp:Parameter DefaultValue="1" Name="YearGroup" />
   <asp:Parameter DefaultValue="1" Name="Category" />
</SelectParameters>

This doesn’t work either.

    <asp:SqlDataSource ID="ListViewSqlDataSource" runat="server" 
        ConnectionString="<%$ *** %>" 
        SelectCommand="EXEC [Docs].[CategoryList]" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DefaultValue="8882074" Name="UserName" />
            <asp:Parameter DefaultValue="9" Name="Service" />
        </SelectParameters>
    </asp:SqlDataSource>

Gives me this error. “””Could not find stored procedure ”.”””

But changing the selectcommand to this works fine.

    SelectCommand="EXEC [Docs].[CategoryList] @UserName = 8882074, @Service = 9"

So how do i pass parameters when executing stored procedure? Thanks.

  • 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-28T13:27:29+00:00Added an answer on May 28, 2026 at 1:27 pm

    If you want to call a stored procedure, you should:

    • set the SelectCommand to just the stored procedure name
    • set the SelectCommandType to SelectCommandType.StoredProcedure

    With this, all the usual parameter stuff works as before!

    SelectCommand="Docs.[DocumentList]" SelectCommandType="StoredProcedure"
    

    Update: the SelectCommand should be JUST the stored proc name! No EXEC or anything else……

    Try this:

    <asp:SqlDataSource ID="ListViewSqlDataSource" runat="server" 
        ConnectionString="<%$ *** %>" 
        SelectCommand="[Docs].[CategoryList]"   **JUST THE STORED PROC NAME !!**
        SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter DefaultValue="8882074" Name="UserName" />
            <asp:Parameter DefaultValue="9" Name="Service" />
        </SelectParameters>
    </asp:SqlDataSource>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Will this query work? Is it most efficient? SELECT * FROM `posts` WHERE MATCH
ATM i cant quiet imagine how this will work. I'm sure it can be
What do I have to do so that this will work in the console
I would like to do the following but I don't think this will work:
I've tried this: CATransform3D rotationTransform = [[self.layer presentationLayer] transform]; This will not work, since
Will this work for testing whether a value at position index exists or not,
I am unsure why this code will not work. When I click a button
How can i make an extension method that will work like this public static
I know downcasting like this won't work. I need a method that WILL work.
Is there a reason why this query doesn't work? The following query will work

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.