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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:07:10+00:00 2026-06-03T00:07:10+00:00

I read my dropdownlost data from one of my tables on database . I

  • 0

I read my dropdownlost data from one of my tables on database . I want to add an external value ( Select ) to my dropdownlist ..
This is my datasorource sql code

SELECT        ID, Part, fxCarId
FROM            tblParts
WHERE        (fxCarId = @fxCarId)
UNION
SELECT        TOP (1) 0 AS Expr2, 'Select' AS Expr1
FROM            tblParts AS tblParts_1

How can I add this ‘ Select ‘ text into my dropdownlist ?

  • 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-03T00:07:11+00:00Added an answer on June 3, 2026 at 12:07 am

    You were along the right lines, but your union requires that both statements have the same number of columns, you had 2 columns in the top part and only 2 on the bottom.

    SQL-Server also doesn’t require that you select directly from a table, so rather than doing SELECT TOP 1 from a table, you can specify your values directly:

    SELECT  ID, Part, fxCarId
    FROM    tblParts
    WHERE   fxCarId = @fxCarId
    UNION
    SELECT  0, 'Select', 0
    

    What I tend to do to ensure “Select” is at the top of any drop down is add a SortOrder column, this way you can ensure “Select” is the default value at the top of the list, but the remainder of the drop down is in alphabetical order which is more logical for the user.

    SELECT  ID, Part, fxCarId, 1 [SortOrder]
    FROM    tblParts
    WHERE   fxCarId = @fxCarId
    UNION
    SELECT  0, 'Select', 0, 0
    ORDER BY SortOrder, Name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Read about Server push here . I want to push data to client from
I'm creating a drop down via <%= Html.DropDownList(data.Language, Model.LanguageOptions) %> and want to read
Ok guys, so I read this: How to set SelectedValue of DropDownList in GridView
I have a dropdownlist that I want to populate with a specific value and
I am populating a DropDownList from a SQL Server database as shown below. It
Afternoon All, I have a dropdown list which extracts data from my SQL database
I have a dropdownlist that is bound from a separate dropdownlist selected value, on
Read on before you say this is a duplicate, it's not. (as far as
Read (skimmed enough to get coding) through Erlang Programming and Programming Erlang . One
Read about the issue in this stackoverflow question . Still have the same issue

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.