public IList retrieveNewTrans(TranslineFilter filter)
{
string str = "EX686";
string sHql = " select into NewTransline p0 from (select count(TraId),Oilcarrier,Tradate,Equipcode,Class,IssueToEamcode,OiltypeEamStore,OiltypeEamBin,sum(Oilqtyvolume),sum(Oilqty),EvttypeDesc,Oilingcheck,Oiledcheck,Eamsydn from Transline where Equipcode='" + str + "' group by Equipcode) ";
sHql += " where 1=1 ";
if (filter.TranType != null && filter.TranType.Trim() != string.Empty)
{
sHql += " and p0.Evttype = '" + filter.TranType + "'";
}
if (filter.Trandept != null && filter.Trandept.Trim() != string.Empty && filter.Trandept != "*")
{
sHql += " and p1.CarDept like '" + filter.Trandept + "%'";
}
if (filter.StartDate != null)
{
sHql += " and p0.Tradate >= to_date('" + filter.StartDate.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
}
if (filter.FinishDate != null)
{
sHql += " and p0.Tradate <= to_date('" + filter.FinishDate.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
}
if (filter.TranEmp != null && filter.TranEmp.Trim() != string.Empty)
{
sHql += " and p0.Empcode = '" + filter.TranEmp + "'";
}
if (filter.TranCarcode != null && filter.TranCarcode.Trim() != string.Empty)
{
sHql += " and p1.CarCode = '" + filter.TranCarcode + "'";
}
if (filter.TranOiltype != null && filter.TranOiltype.Trim() != string.Empty)
{
sHql += " and p0.Oiltype = '" + filter.TranOiltype + "'";
} sHql += " and p0.Oilqty > 0)";
return control.GetEntities(sHql);
}
语句有错,求高手指点。
{
string str = "EX686";
string sHql = " select into NewTransline p0 from (select count(TraId),Oilcarrier,Tradate,Equipcode,Class,IssueToEamcode,OiltypeEamStore,OiltypeEamBin,sum(Oilqtyvolume),sum(Oilqty),EvttypeDesc,Oilingcheck,Oiledcheck,Eamsydn from Transline where Equipcode='" + str + "' group by Equipcode) ";
sHql += " where 1=1 ";
if (filter.TranType != null && filter.TranType.Trim() != string.Empty)
{
sHql += " and p0.Evttype = '" + filter.TranType + "'";
}
if (filter.Trandept != null && filter.Trandept.Trim() != string.Empty && filter.Trandept != "*")
{
sHql += " and p1.CarDept like '" + filter.Trandept + "%'";
}
if (filter.StartDate != null)
{
sHql += " and p0.Tradate >= to_date('" + filter.StartDate.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
}
if (filter.FinishDate != null)
{
sHql += " and p0.Tradate <= to_date('" + filter.FinishDate.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
}
if (filter.TranEmp != null && filter.TranEmp.Trim() != string.Empty)
{
sHql += " and p0.Empcode = '" + filter.TranEmp + "'";
}
if (filter.TranCarcode != null && filter.TranCarcode.Trim() != string.Empty)
{
sHql += " and p1.CarCode = '" + filter.TranCarcode + "'";
}
if (filter.TranOiltype != null && filter.TranOiltype.Trim() != string.Empty)
{
sHql += " and p0.Oiltype = '" + filter.TranOiltype + "'";
} sHql += " and p0.Oilqty > 0)";
return control.GetEntities(sHql);
}
语句有错,求高手指点。
解决方案 »
- 请问app.config和 xx.exe.config的关系
- 【Nunit线程测试】
- 求 linux 下C#開發 Mono的安裝及使用方法
- 怎么得到大量动网论坛地址?
- 想用C#开发一个在IE浏览器中查看office文档的控件,请给个例子!
- 救命啊~~QuartzTypeLib组件加载问题~请指点啊~郁闷~~ 在线等
- 求ojlovecd、amandag、lxcnn、q107770540四大虾都不会的C#问题
- 如何设置和取得一个Component的名字?
- Winform 怎么打开IE 并 设置Cookie 来自动登录
- 哈尔滨ACCP的同学们来这里签个名!我是王飞龙
- I CALL!我又遇难了!dataGridView1.SelectionChanged 执行两次问题!
- qq空间游戏(非仙勿扰)外挂架构设计,欢乐讨论.
这样写INSERT INTO NewTransline SELECT * FROM tableA
Oilingcheck,Oiledcheck,Eamsydn) p0 (select count(TraId),Oilcarrier,Tradate,Equipcode,Class,IssueToEamcode,OiltypeEamStore,OiltypeEamBin,
sum(Oilqtyvolume),sum(Oilqty),EvttypeDesc,Oilingcheck,Oiledcheck,Eamsydn from Transline where Equipcode='EX686' group by Equipcode) where 1=1
and p0.Evttype = 'OILING' and p1.CarDept like '33021409%' and p0.Tradate >= to_date('2012-4-7 10:00:27','yyyy-MM-dd HH24:mi:ss')
and p0.Tradate <= to_date('2012-4-8 10:00:27','yyyy-MM-dd HH24:mi:ss') and p0.Oilqty > 0)
Oilingcheck,Oiledcheck,Eamsydn) values (select count(TraId),Oilcarrier,Tradate,Equipcode,Class,IssueToEamcode,OiltypeEamStore,OiltypeEamBin,
sum(Oilqtyvolume),sum(Oilqty),EvttypeDesc,Oilingcheck,Oiledcheck,Eamsydn from Transline where Equipcode='EX686' group by Equipcode) where 1=1
and p0.Evttype = 'OILING' and p1.CarDept like '33021409%' and p0.Tradate >= to_date('2012-4-7 10:00:27','yyyy-MM-dd HH24:mi:ss')
and p0.Tradate <= to_date('2012-4-8 10:00:27','yyyy-MM-dd HH24:mi:ss') and p0.Oilqty > 0)
说values 后面缺少表达式?
INSERT INTO NewTransline SELECT * FROM tableA
你把你的表数据贴出来我给你看看
CREATE TABLE A
(
a01 INT,
a02 VARCHAR(10) )
INSERT INTO A
SELECT 1,'haha' UNION ALL
SELECT 2,'gaga' UNION ALL
SELECT 3,'jiji' CREATE TABLE C
(
c01 INT,
c02 VARCHAR(10) )
--DROP TABLE C
INSERT INTO C SELECT * FROM A
SELECT * FROM C
/*(所影响的行数为 3 行)c01 c02
----------- ----------
1 haha
2 gaga
3 jiji(所影响的行数为 3 行)
*/
{
string str = "EX686";
string sHql = " insert into NewTransline p0 (TraId,Oilcarrier,Tradate,Equipcode,Class,IssueToEamcode,OiltypeEamStore,OiltypeEamBin,Oilqtyvolume,Oilqty,EvttypeDesc,Oilingcheck,Oiledcheck,Eamsydn) (select count(TraId),Oilcarrier,Tradate,Equipcode,Class,IssueToEamcode,OiltypeEamStore,OiltypeEamBin,sum(Oilqtyvolume),sum(Oilqty),EvttypeDesc,Oilingcheck,Oiledcheck,Eamsydn from Transline where Equipcode='" + str + "' group by Equipcode) ";
sHql += " where 1=1 ";
if (filter.TranType != null && filter.TranType.Trim() != string.Empty)
{
sHql += " and p0.Evttype = '" + filter.TranType + "'";
}
if (filter.Trandept != null && filter.Trandept.Trim() != string.Empty && filter.Trandept != "*")
{
sHql += " and p1.CarDept like '" + filter.Trandept + "%'";
}
if (filter.StartDate != null)
{
sHql += " and p0.Tradate >= to_date('" + filter.StartDate.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
}
if (filter.FinishDate != null)
{
sHql += " and p0.Tradate <= to_date('" + filter.FinishDate.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
}
if (filter.TranEmp != null && filter.TranEmp.Trim() != string.Empty)
{
sHql += " and p0.Empcode = '" + filter.TranEmp + "'";
}
if (filter.TranCarcode != null && filter.TranCarcode.Trim() != string.Empty)
{
sHql += " and p1.CarCode = '" + filter.TranCarcode + "'";
}
if (filter.TranOiltype != null && filter.TranOiltype.Trim() != string.Empty)
{
sHql += " and p0.Oiltype = '" + filter.TranOiltype + "'";
} sHql += " and p0.Oilqty > 0)";
return control.GetEntities(sHql);
}方法是这个。