0

Im fairly new to Asp.Net arena here guys,so please bear with me if say something that's not logical.

I have a procedure that binds to a grid-view that displays data based on the selection made from a drop-down box. It works fine when a single value is sent but I'm thinking of doing multiple selection from the drop-down[using checkboxes] or even using a list-view, and I'm confused how to go about it. This is the code for the stored procedure. At the moment it accepts only a single value. For e.g., if I select Africa from the drop-down it displays all the cities from Africa. But now I would like to have multiple selections for the drop-down so that the grid display cities from more than one country.

CREATE PROCEDURE sp_getCities 
(
@p_country  nvarchar(50)
)
AS

SELECT country, cities
FROM world WHERE country=@p_country

I'm sure there are people who must have come across situations like this. If you have could you please provide me with a link to a tutorial or a solution?

0

2 Answers 2

2

Here's the (almost canonical) answer:

Sign up to request clarification or add additional context in comments.

Comments

0

One way is to pass XML into a stored procedure and using the system stored procedure sp_xml_preparedocument. Essentially, you pass XML into the stored procedure and operate on it in a SET oriented manner.

Check out this link to get you started with this approach.

http://msdn.microsoft.com/en-us/library/ms187367.aspx

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.