Click here to Skip to main content
15,886,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a method inside the repository, when i am calling that method in the wcfservice it returns the list as null but when i am running the query it is running well but in service method it returns a null list... i dont know where the problem is ..

my code is like this:

in repository the method is :
public List<BUILD_INFO> GetChartInfo(string lineNo, string shiftDateTime, string station)
{
string query = string.Format("SELECT SUM(QTY_BUILD) AS BUILD_QTY, SUM(QTY_FAIL) AS FAIL_QTY, "+
"DATEPART(HH,BUILD_HOUR) AS SHIFT_HOURS FROM BUILD_INFOWITH (NOLOCK) "+
"WHERE LINE_NO='{0}' AND BUILD_HOUR >='{1}' AND STATION='{2}' "+
"GROUP BY DATEPART(HH,BUILD_HOUR) ORDER BY SHIFT_HOURS ",_tableName, lineNo, shiftDateTime, station);

return MYRepository.Fetch<BUILD_INFO>(query);
}
i am calling this method in the service as follows:

var buildInfo=new BuildInfoRepository();
var build=buildInfo.GetChartInfo(lineNo,datetime,station);

in build i am getting null only..

thanks in advance..

kpr.
Posted
Updated 19-Aug-13 21:32pm
v2
Comments
ali_heidari_ 20-Aug-13 3:43am    
you missed {4}... and your first place ({0}) is for tablename variable ,but you used in where statement! remove _tableName ...
codeninja-C# 20-Aug-13 5:52am    
can you provide the code for mentioned method
MYRepository.Fetch<build_info>(query);
--SJ

1 solution

Not sure if I am missing anything but you do declare 4 variables but I do not see the place holder for the first. It only starts at {1}. Where is {0}?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900