sql - How to pass the data to OracleCommand Class c# -
i trying pass variable sql script , run in using c#.
i error saying
"missing expression".
fromdate , todate passed 'dd//mm//yy format. not passing parametres coorectly using oraclecommand ?
public void transactionreport(string fromdate, string todate) { string query = "select s.store_code,count(i.invc_sid) count invoice_v left join store_v s on i.sbs_no = s.sbs_no , i.store_no = s.store_no where(i.created_date between to_date(@fromdate,'mm//dd//yy') , to_date(@todate,'mm//dd//yy')) , i.proc_status not in ('131072','65536','147456', '81920') , i.invc_type = 0 , i.sbs_no = 6 group s.store_code"; conn.open(); using (oraclecommand cmd = new oraclecommand(query, conn)) { cmd.parameters.add(new oracleparameter("fromdate", fromdate)); cmd.parameters.add(new oracleparameter("todate", todate)); oracledatareader dr = cmd.executereader();
try :
instead of @
string query = "select s.store_code,count(i.invc_sid) count invoice_v left join store_v s on i.sbs_no = s.sbs_no , i.store_no = s.store_no where(i.created_date between to_date(:fromdate,'mm//dd//yy') , to_date(:todate,'mm//dd//yy')) , i.proc_status not in ('131072','65536','147456', '81920') , i.invc_type = 0 , i.sbs_no = 6 group s.store_code";
Comments
Post a Comment