How do I use Eval() with Repeater Control?

Hi all,
I have a problem about data binding with repeater control.
My sales table has Record_ID, Date(smalldatetime), Agent_ID......... and more columns.
I created stored procedure for 7 days period to see agents daily sales report.
When i bind database with eval function using stored procedure USP_TotalDailySales @Agent_ID=value, 1 record is return like this:

Column Headers:ID,Agent_ID, 0(26.04.2010), 1(25.04.2010), 2(24.04.2010), 3(23.04.2010), 4(22.04.2010), 5(21.04.2010), 6(20.04.2010)
Record:1,1,23(Agent 1 has total sales),12,3,11,2,10,22

I want to see all of agent records. What is way to provide?

My procedure is here:


CREATE PROCEDURE USP_TotalDailySales @Agent_ID tinyint
AS
BEGIN

DECLARE @Today varchar(10)
DECLARE @Today_minus_1 varchar(10)
DECLARE @Today_minus_2 varchar(10)
DECLARE @Today_minus_3 varchar(10)
DECLARE @Today_minus_4 varchar(10)
DECLARE @Today_minus_5 varchar(10)
DECLARE @Today_minus_6 varchar(10)
DECLARE @Agent varchar(50)


SELECT @Today=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE(),104) AND CONVERT(varchar(10),GETDATE(),104)


SELECT @Today_minus_1=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE()-1,104) AND CONVERT(varchar(10),GETDATE()-1,104)

SELECT @Today_minus_2=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE()-2,104) AND CONVERT(varchar(10),GETDATE()-2,104)

SELECT @Today_minus_3=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE()-3,104) AND CONVERT(varchar(10),GETDATE()-3,104)

SELECT @Today_minus_4=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE()-4,104) AND CONVERT(varchar(10),GETDATE()-4,104)

SELECT @Today_minus_5=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE()-5,104) AND CONVERT(varchar(10),GETDATE()-5,104)

SELECT @Today_minus_6=COUNT(*) FROM tbl_Sales
WHERE Agent_ID=@Agent_ID AND  CONVERT(varchar(10),dbo.tbl_Sales.Date,104) BETWEEN CONVERT(varchar(10),GETDATE()-6,104) AND CONVERT(varchar(10),GETDATE()-6,104)


SELECT @Agent_ID AS ID, @Today AS '0', @Today_minus_1  AS '1',@Today_minus_2 AS '2',@Today_minus_3  AS '3',@Today_minus_4  AS '4',@Today_minus_5  AS '5',@Today_minus_6 AS '6' 


END


GO

Open in new window

pompicikAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

devhelperCommented:
Pass @Agent_ID as NULL and check in the SQL

SELECT @Today=COUNT(*) FROM tbl_Sales
WHERE (Agent_ID=@Agent_ID OR isnull(@Agent_ID,0) = 0)
0
pompicikAuthor Commented:
I tried but only one record is returned and null
0
devhelperCommented:
You will get only one record since you are passing variables.
Instead create temp table and return the same.
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

pompicikAuthor Commented:
I was tried insert record to temp table but stored procedure only inserts one record each process. I cant declare agent ids for different querys.
0
devhelperCommented:
0
pompicikAuthor Commented:
I resolved my problem with using table variable.

In a while loop all records inserted table variable less than 255, and  i can select from all of recordset.
Thank you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.