安装使用ODP.Net command.BindByName = true
作者:互联网
command.BindByName = true;
默认情况下ODP.Net 绑定变量时,sql语句中的变量顺序必须和变量绑定顺序一致,否则Fill查不到数据,cmd.ExecuteNonQuery()返回0无法执行,
将BindByName 设为true后,sql变量顺序和绑定顺序即可不一致(以下代码不设置BindByName 则查不出数据)
DBHelper dbHelper = new DBHelper(); string sqlstr = "SELECT cc.*,ROWID FROM cde_city cc WHERE cc.provinceid=:provinceid AND cc.cityid=:cityid"; ParamsHelper parHepler = new ParamsHelper(); parHepler.Add(":cityid", "002"); parHepler.Add(":provinceid", "01"); DataTable dt = dbHelper.GetDataTable(sqlstr, parHepler.ListParameter);
标签:parHepler,ODP,BindByName,cityid,cc,true,provinceid 来源: https://www.cnblogs.com/luluping/p/14284838.html