Hey Everyone,
I was wondering how I would get two output values from a single Stored Procedure using Linq. I need one to Bind with a DataView Control and another to set to an int variable.
Here is the call of the SP currently:
GVSearchResults.DataSource = db.search_FindFiles(
words[0],
(words.Length > 2 ? words[1] : " "),
(words.Length > 3 ? words[2] : " "),
(words.Length > 4 ? words[3] : " "),
(words.Length > 5 ? words[4] : " "),
(typeID != null ? typeID : "(-1)"),
(dateType != null ? dateType : "NetworkFileCreationDate"),
(dateOperator != null ? dateOperator : ">"),
(calDateSelected.SelectedDate.Date.ToShortDateString() == "1/1/0001"
? "1/1/1900" : calDateSelected.SelectedDate.Date.ToShortDateString()),
tableToSearch.LastTableFilled,
chkBxContent.Checked,
sortColumn,
sortDirection,
int.Parse(currentPage),
50
);GVSearchResults.DataBind();
rowCount = ?
First Select Statement:
SET @Sql= @Sql + '
SELECT st.NetworkFileName, nf.NetworkFileLocation, nft.TypeName,
convert(varchar(50), nf.NetworkFileModifiedDate, 101) AS NetworkFileModifiedDate,
ROW_NUMBER() OVER(ORDER BY ' + @SortColumn + ') as ID
FROM #SearchTemp st
JOIN search_NetworkFiles' + ltrim(rtrim(str(@Table))) + ' nf on st.FileID = nf.FileID
JOIN search_NetworkFileTypes nft ON nf.TypeID = nft.TypeID
WHERE ' + str(@PageStart) + ' = 0 OR (ID between @FirstRec AND @LastRec)
ORDER BY '
SET @Sql = @Sql + CASE @SortDirection
WHEN 'DESC' THEN ' ID * -1 '
WHEN 'desc' THEN ' ID * -1 '
ELSE ' ID '
END
Second Select Statment:
SET @Sql = @Sql + 'SELECT @TotalRows as TotalRows '
Any Help would be greatly appreciated.