0

I have a gridview that pulls from an sqldatasource, this sql datasource pulls from a table called survey, lets say that this survey table has : survey_id, survey_name, survey_description, and category_id. The category ID is a foreign key referring to a category table. the category table has category_id, name and description. Is there a way i can replace the category_id in the gridview and take instead the name where its ID is equal to the ID in the survey table?

2 Answers 2

1

Yes, you can! You will need to change the SelectCommand for your SQLDataSource so that you are inner joining on the category table. You can then select the name from the category table, and bind it to the gridview.

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

Comments

1

Try this MS SQL COMMAND

SELECT SR.survey_id, SR.survey_name, SR.survey_description,CA.name
FROM Tbl_Survey SR
INNER JOIN Tbl_Category CA 
ON SR.category_id.Id=CA.category_id;

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.