c# - Why stored procedure result is zero? -
work on c# vs 2008. have stored procedure in sql server 2005. using linq-to-sql execute stored procedure, result zero. when run query in sql server it's work fine
exec spgetinvoicebydate '03/01/2011 00:00:00 am','03/31/2011 11:59:59 pm' above syntax works fine.
here sql server stored procedure
create procedure [spgetinvoicebydate] @beginning_date datetime, @ending_date datetime begin select * #temp1 ( select convert(varchar, manifestport.startdate, 1)+'-'+case dbo.manifestport.enddate when '1800-01-01 00:00:00.000' 'n/a' else convert(varchar, manifestport.enddate, 1) end [date], manifest.vesselname, manifest.voyageno, dischargeport.portname , manifestport.terminal, count(seal.containerno) totalcontainers, 0 totalhours, 0 totalfee manifestport inner join manifest on manifestport.manifestno = manifest.manifestno inner join dischargeport on manifestport.portcode = dischargeport.portcode inner join seal on manifestport.manifestportno = seal.manifestportno (startdate between @beginning_date , @ending_date) group startdate,enddate, vesselname, voyageno, portname, terminal) select * #temp2 ( select convert(varchar, manifestport.startdate, 1)+'-'+case dbo.manifestport.enddate when '1800-01-01 00:00:00.000' 'n/a' else convert(varchar, manifestport.enddate, 1) end [date], manifest.vesselname, manifest.voyageno, dischargeport.portname, manifestport.terminal, count(seal.containerno) stotalcontainers, 0 stotalhours, 0 stotalfee manifestport inner join manifest on manifestport.manifestno = manifest.manifestno inner join dischargeport on manifestport.portcode = dischargeport.portcode inner join seal on manifestport.manifestportno = seal.manifestportno (startdate between @beginning_date , @ending_date ) , line = 'csav' group startdate,enddate, vesselname, voyageno, portname, terminal ) b select #temp1.date, #temp1.vesselname , #temp1.voyageno , #temp1.portname , #temp1.terminal , #temp1.totalcontainers , #temp1.totalhours , #temp1.totalfee, #temp2.stotalcontainers, #temp2.stotalhours, #temp2.stotalfee #temp1 inner join #temp2 on #temp1.date = #temp2.date , #temp1.portname = #temp2.portname , #temp1.terminal = #temp2.terminal , #temp1.vesselname = #temp2.vesselname , #temp1.voyageno = #temp2.voyageno order #temp1.vesselname, #temp1.voyageno drop table #temp1 drop table #temp2 end i use c# linq syntax execute stored procedure:
datetime firstdayofmonth = convert.todatetime("03/01/2011"); datetime lastdayofmonth = convert.todatetime("03/31/2011"); var results = providername.spgetinvoicebydate(firstdayofmonth,lastdayofmonth); why result zero?
can tell me how reduce problem?
thanks in advance, if have question, please ask.
have tried executing stored proc (on sql server management studio) replacing @beginning_date , @ending_date values pass in c# linq code? return result? if it's 0, explains why linq code returns 0.
hope helps.
Comments
Post a Comment