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?
 
pompicikConnect With a Mentor Author 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
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
devhelperConnect With a Mentor Commented:
You will get only one record since you are passing variables.
Instead create temp table and return the same.
0
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.