Display Records in gridView Acording to selected items from list box [Resolved]

Posted by Pallubhosale under Sql Server on 1/8/2014 | Points: 10 | Views : 1901 | Status : [Member] | Replies : 2
Hi all,
I want Stored Procedure Which can display record in grid view according to text in LIST Box.There may be more than 1 record in list box.
e.g In lstTitle List box there are more than 1 course title.
I want to display record FileNo, CourseTitle,NAME,NRIC,STARTDATE,ENDDATE who attended that coursetitle in Grid view.

Pallavi


Responses

Posted by: Pallubhosale on: 1/8/2014 [Member] Starter | Points: 25

Up
0
Down

Resolved
I got answer We can do it by creating temperary table and store record of courses in that table
as bellow

Create PROCEDURE [dbo].[TAMS_TRANING_RECORD]
(
@p_tblTitle dbo.TAMS_COURSE_CAT_Type READONLY

)
AS
BEGIN

SELECT DISTINCT a.FILENO,a.TITLE,b.NRIC,p.OLDNRIC,b.NAME,a.STARTDATE,a.ENDDATE FROM TRAINING a
INNER JOIN PARTICULARS b ON
a.FILENO = b.FILENO
INNER JOIN PERSONAL p ON
b.NRIC=p.NRIC
WHERE a.TITLE in (SELECT COURSECAT From @p_tblTitle)
ORDER BY TITLE

END

Pallavi

Pallubhosale, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: kgovindarao523-21772 on: 1/8/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,
Try this Code:

CREATE PROCEDURE sp_Test
(
@coursetitle varchar(100)
)
As
Begin

SELECT FileNo, CourseTitle,NAME,NRIC,STARTDATE,ENDDATE FROM YOURTABLE
WHERE CourseTitle Like '%'+@coursetitle+'%'

End


Thank you,
Govind

Pallubhosale, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response