Adding additional data adapter parameters at run time

I'm working on a report form which just contains a data adapter and a listview.  The backend is Microsoft SQL server.  The SQL for the report is

SELECT        Contact.ContactID, Contact.ContactDisplayName, Contact.ContactAddressCSV, Contact.ContactAdviserID, Contact.ContactLocalAuthorityID,
                         Contact.ContactAgeGroupID, Contact.ContactSexID, Contact.ContactEmploymentStatusID, Contact.ContactEnquirySourceID, Contact.ContactDOB,
                         Contact.ContactEthnicity, Contact.ContactBHEOfficeID, Session.SessionDisplayName, Session.SessionSatisfactionID, Session.SessionLocation,
                         Session.SessionNotes, Session.SessionAdvisorID, Session.SessionType, Session.SessionPrice, Session.SessionBackground
FROM            Contact INNER JOIN
                         ContactSession ON Contact.ContactID = ContactSession.ContactSessionContactID INNER JOIN
                         Session ON ContactSession.ContactSessionSessionID = Session.SessionID
WHERE        (Session.SessionDate >= @FromSessionDate) AND (Session.SessionDate <= @ToSessionDate) AND (Session.SessionType = @SessionType) AND
                         (Contact.ContactLocalAuthorityID = @LocalAuthorityTypeID)

The parameters are specified at run time as the users pick options from drop downs and then click run and it then runs the above SQL code using a data adapter.  This works fine but there's one problem, the LocalAuthorityTypeID could be one of up to 50 choices.  So I need the ability to add additional OR statements to the data adapter that contains this SQL command text at run time.

Does anybody have any ideas of a way to go about the above?  OR even better still is there an easier way to achieve the above result?
Who is Participating?
You could specify the Parameters of the SqlCommand. Have a look at this:
Sorry not to understand. Do you want Contact.ContactLocalAuthorityID = @LocalAuthorityTypeID be changet to something as  @LocalAuthorityTypeID IN (<list of possible IDs>) ?
Or you want to fill dropdown by walues from database?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.