A query working on sql studio, but doesn't work on C# -
i have query , results when execute on sql studio:
select teamname, count(*) nethoz_decision inner join nethoz_case on nethoz_decision.casedisplayidentifier = nethoz_case.casedisplayidentifier inner join maintik on maintik.counter = nethoz_case.tikcounter inner join teams on maintik.teamcounter = teams.counter nethoz_decision.decisionstatuschangedate between '2015-07-23' , '2015-07-28' group teamname
but when execute on c# sqlcommand don't result. dataset empty , don't error. thought problem might on date. converting right?
string date1 = string.format("{0:yyyy-mm-dd}", datetimepicker1.value); string date2 = string.format("{0:yyyy-mm-dd}", datetimepicker2.value.adddays(1));
using sqlcommand , type-safe parameters
const string query = " select teamname, count(*) nethoz_decision inner join nethoz_case on nethoz_decision.casedisplayidentifier = nethoz_case.casedisplayidentifier inner join maintik on maintik.counter = nethoz_case.tikcounter inner join teams on maintik.teamcounter = teams.counter nethoz_decision.decisionstatuschangedate between @from , @to group teamname "; sqlcommand command = new sqlcommand(query); command.parameters.addwithvalue("@from", datetimepicker1.value); command.parameters.addwithvalue("@to", datetimepicker2.value.adddays(1));
Comments
Post a Comment