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

  • Home
  • SEARCH
  • 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 278985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:19:37+00:00 2026-05-12T01:19:37+00:00

I have an ASP SqlDataSource connected to Sybase DB query, using Select Parameters that

  • 0

I have an ASP SqlDataSource connected to Sybase DB query, using Select Parameters that are populated by a dropdown:

Dropdown (works OK):

<asp:SqlDataSource ID="dsBondIDList" runat="server" 
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
    SelectCommand="SELECT [name], [bondID] FROM [bonds]">
</asp:SqlDataSource>
<asp:DropDownList ID="lstBondID" runat="server" DataSourceID="dsBondIDList" DataTextField="name" DataValueField="bondID">

SqlDataSource with parameter:

    <asp:SqlDataSource ID="dsBonds" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT [ticker], [name], [isin], [currency], 
                       [stock], [maturity], [bid], [ask] 
                       FROM [bonds] where [bondID] = @bondID">
        <SelectParameters>
            <asp:ControlParameter Name="bondID" ControlID="lstBondID" PropertyName="SelectedValue" DefaultValue="-1" />
        </SelectParameters>    
    </asp:SqlDataSource>

But I get an error when I try to run it:

ERROR [HY000] [DataDirect][ODBC Sybase Wire Protocol driver][SQL Server]Must declare  variable '@bondID'.

Which of course I would get it I ran the sql literally as displayed. I expect the ASP engine to do the substitution before sending the query (and to use the default value of lstBondID if necessary)

Does anybody know why the @bondID is not being substituted with the lstBondID.SelectedValue?

Thanks in advance

Ryan

  • 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-12T01:19:37+00:00Added an answer on May 12, 2026 at 1:19 am

    I just went through this problem 10 minutes ago and here’s the fix:

    If you need to keep using the ODBC driver you have, change your query to use ? instead of Named Parameters.

    SELECT [ticker], [name], [isin], [currency], 
    [stock], [maturity], [bid], [ask] 
    FROM [bonds] where [bondID] = ?
    

    The parameters are used in the order they are added to the parameters collection (This gets hairy when you need to use the parameter more than once in your query etc).

    Otherwise you can change drivers. Look for sybdrvodb.dll and regsvr32 it. Then setup your DSN and use that.

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

Sidebar

Ask A Question

Stats

  • Questions 173k
  • Answers 173k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Though I have not checked it yet, I think SubSonic… May 12, 2026 at 2:40 pm
  • Editorial Team
    Editorial Team added an answer The solution is to add some imports import javax.sql.DataSource import… May 12, 2026 at 2:40 pm
  • Editorial Team
    Editorial Team added an answer I put mine 3rd party libs/assemblies in a folder at… May 12, 2026 at 2:40 pm

Related Questions

I'm having a problem getting a simple ASP.NET webpage to display. The page contains
I have an ASP.net project I'm looking at and they want to use MySQL.
I'm designing some VB based ASP.NET 2.0, and I am trying to make more
I'm having a strange problem here... I have an ASP.NET 3.5 application that has

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.