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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:05:24+00:00 2026-05-20T12:05:24+00:00

I have a form with 3 combo boxes. The value of the combo boxes

  • 0

I have a form with 3 combo boxes. The value of the combo boxes generates a SQL query with 3 parameters. The SQL generates a RDLC report.

For example:

Combox1 with values(v1,v2,v3,ALL)

Combox2 with values(v1,v2,ALL)

Combox3 with values(v1,v2,v3,4,ALL)

Me.ExampleTableAdapter.QueryWithParams(Me.ExampleDataSet.Table, Combobox1.SelectedIndex, Combobox2.SelectedIndex,Combobox1.SelectedIndex)

QueryWithParams:

SELECT * FROM Table WHERE Column1=@c1 AND Column2=@c2 AND Column3=@c3

Ok, the problem is when the selected value is ALL in the combo X, I cannot get the values because I must change the query and kick out the parameter.
For example:
If the combo1, combo2, combo3 have the values ALL. I don’t need parameters.

SELECT * FROM Table 

If the combo1 is ALL.

SELECT * FROM Table WHERE Column2=@c2 AND Column3=@c3

If combo1 and combo3 are ALL

SELECT* FROM Table WHERE Column2=@c2 

…
Then in code I look which is the selected value of the combo and upon it I do the query.

Is there a way that i do this thing without generating all 8 types of queries?

PS. I cannot use stored procedures because I’m using SQL Server Compact

  • 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-20T12:05:24+00:00Added an answer on May 20, 2026 at 12:05 pm

    If the value for ‘ALL’ should be sent to the query with value ‘NULL’

    SELECT * 
    FROM Table 
    WHERE (Column1=@c1 OR @c1 IS NULL)
    AND (Column2=@c2 OR @c2 IS NULL)
    AND (Column3=@c3 OR @c3 IS NULL)
    

    Edit:
    Of course same can be done for any specified ‘ALL’-value
    Example of ‘ALL’ = -1

    (Column1=@c1 OR @c1 = -1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form in VB6 with two combo boxes (cboCustomer and cboItemNumber). When
I have a combo box and several text boxes on a form. When I
I have a form in which people will be entering dollar values. Possible inputs:
I have five combo boxes. Each one has a different name, but the possible
I have an Access 2003 project in which all data is stored in SQL
I have form, the form contains JavaStaticText fields, and Combo box, and Text fields.
I have a form in Excel with a combo box control. I want the
I have a form that is loading quite an amount of data from SQL
I have a custom control that has several text boxes and combo boxes in
I am making desktop application. So, I have to apply checks on combo boxes

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.