SELECT stInfo.stId, stInfo.stName, stInfo.stName+' '+stInfo.stFamily as nf, stInfo.stFamily, stInfo.stimage FROM Field INNER JOIN Course ON Field.idField = Course.idField INNER JOIN stInfo INNER JOIN Class ON stInfo.stClass = Class.idClass ON Course.idField = stInfo.stField where stClass='" + Session["gradlistkls"] + "' and Course.idCourse='" + Session["gradlistdrs"] + "'
SELECT stInfo.stId, stInfo.stName, stInfo.stName+' '+stInfo.stFamily as nf, stInfo.stFamily, stInfo.stimage FROM Field INNER JOIN Course ON Field.idField = Course.idField INNER JOIN stInfo INNER JOIN Class ON stInfo.stClass = Class.idClass ON Course.idField = stInfo.stField where stClass='" + Session["gradlistkls"] + "' and Course.idCourse='" + Session["gradlistdrs"] + "'
I used SessiontoFilter Select command.(Session["gradlistdrs"] and Session["gradlistkls"] )
Since you are having concatenating operation inside the query, IMHO best option is to use StoredProcedure and then use
SessionParameters in SQLDatasource
CREATE PROCEDURE YourStoredProcname
-- Add the parameters for the stored procedure here
@stClass Varchar(100),
@Course Varchar(100)
AS
BEGIN
-- Select statements for procedure here
SELECT stInfo.stId, stInfo.stName, stInfo.stName+' '+stInfo.stFamily as nf, stInfo.stFamily, stInfo.stimage
FROM Field INNER JOIN Course ON Field.idField = Course.idField
INNER JOIN stInfo INNER JOIN Class ON stInfo.stClass = Class.idClass ON Course.idField = stInfo.stField
where stClass =@stClass and Course.idCourse=@Course
END
GO
Member
54 Points
100 Posts
Select Command - Sql DataSource
May 21, 2016 10:59 AM|csajad|LINK
hi every body
Select Command :
I used Session to Filter Select command.(Session["gradlistdrs"] and Session["gradlistkls"] )
How to write it in the Sql Data Source ?
All-Star
50841 Points
9895 Posts
Re: Select Command - Sql DataSource
May 21, 2016 12:02 PM|A2H|LINK
Since you are having concatenating operation inside the query, IMHO best option is to use StoredProcedure and then use SessionParameters in SQLDatasource
Sample SP
Aje
My Blog | Dotnet Funda
Member
54 Points
100 Posts
Re: Select Command - Sql DataSource
May 21, 2016 07:26 PM|csajad|LINK
thanks a lot .
I Execute Select CMD In sql And I saw results .
I do not know why the information is not loading !!
The session is full .
(But I wrote it all in code behind.)