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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:18:42+00:00 2026-06-13T06:18:42+00:00

I have a table name Students having (studentId, StudentName,Address,PhoneNo) i have provided a filter

  • 0

I have a table name Students having (studentId, StudentName,Address,PhoneNo)

i have provided a filter for user to select only StudentId from Combobox to get the details of Students… and generate Report.

I have written following Query to get student Detail :

(select * from Students where StudentId = stdId)

Here stdId is a Parameter that i pass from code

It works fine if i select single studentId…. But in user selection Comobobox i have also provided "ALL" if user Select All from combobox i want to display details of all student

So what should I pass in stdId if user selects All ?

I used inline Query in C# (not using SQL Stored Procedure)

  • 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-13T06:18:43+00:00Added an answer on June 13, 2026 at 6:18 am

    You can do it like this .

    SELECT * from Students s
    WHERE s.studentId = ISNULL(@StudentId,s.studentId) 
    

    When “All” is selected in combo box pass null in your @studentid parameter. If you can not pass null in parameter then pass -1 or anything which can not be contain in you combox option and do it like this:(if -1= All)

     SELECT * from Students s
     WHERE s.studentId = @StudentId or @StudentId=-1
    

    You can also try the answer given by Curt.

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

Sidebar

Related Questions

Here I have another query bothering me. Select S.ID,S.Name,S.Surname,B.Title,SB.DateAndTimeIssued FROM Students S INNER JOIN
I have reduced a complex schema to the following samples Students StudentID int, Name
I have three tables A, B, C. A having Id,Name,Address coulmns. B is the
Assume that I have a table : students ______________________________________________________ |id | name | school
i have a table named students which have student details id,mark,name i want to
I have a mysql table having register number, dob, student name, sex, total mark
I have Table Students with columns Student ID and Student Name. I also have
Let's say I have a Students table on my main page, with Country, Name,
I have a table that includes some student group name, lesson time, day names
I have a table student ( id, name ). Then I have one textbox,

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.