sql - C# SqlBuilder -- How to use Convert dynamically -


i have sql query:

select        relationid     , convert(date, receiveddate, 10) [date]     , matdesc     , sum(amount)     , sku      tablename      relationid = 1000 group        convert(date, receiveddate, 10)     , relationid     , matdesc     , sku 

which need write dynamically in c# sqlbuilder. far have:

            selectquery qry = new selectquery("db");         qry.withnolock = true;         foreach (exportcolumndefinition exportcolumndef in getexportcolumndefinitions())         {             qry.selectcolumn(exportcolumndef.datafieldname);         }          qry.criteria.addexpressioncriterium("relationid= " + esetting.relationid);         qry.criteria.addcolumncriterium("receiveddate", operator.greaterthanorequalto, datetime.now.adddays(-30));         qry.criteria.addcolumncriterium("receiveddate", operator.lessthanorequalto, datetime.now);         qry.addorderbycolumn("receiveddate", sortorder.descending); 

i'm new use kind of or documentation link. (couldn't find myself.)

-- small edit, i'm missing is: convert , sum.


edit apparently sqlbuilder we're using custom made, disregard question.

you don't need make unnecessary complicated. can write query in sqlcommand constructor.

sqlcommand cmd=new sqlcommand("your query", connetionobj); cmd.executescalar();


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -