- C# code
public IList<BizMain> GetALLBizMainByClientWorkCode(string w_workcode, string name) { string sql = "SELECT * FROM BizMain inner join BizProxy on BizMain.WorkCode = BizProxy.WorkCode Where 1= 1"; sql += " And Client = '" + name + "'"; if (w_workcode != "") { sql += " And WorkCode like '" + w_workcode + "%'"; } sql += "order by WorkCode asc"; List<BizMain> list = new List<BizMain>(); OracleDataReader dr = help.GetReader(sql); while (dr.Read()) { BizMain main = new BizMain(); if (dr["WorkCode"] != DBNull.Value) main.Workcode = Convert.ToString(dr["WorkCode"]); if (dr["BLCode"] != DBNull.Value) main.Blcode = Convert.ToString(dr["BLCode"]); if (dr["CKCode"] != DBNull.Value) main.Ckcode = Convert.ToString(dr["CKCode"]); if (dr["Vessel"] != DBNull.Value) main.Vessel = Convert.ToString(dr["Vessel"]); if (dr["Voyage"] != DBNull.Value) main.Voyage = Convert.ToString(dr["Voyage"]); if (dr["PkgNumber1"] != DBNull.Value) main.Pkgnumber1 = Convert.ToInt32(dr["PkgNumber1"]); if (dr["Weight1"] != DBNull.Value) main.Weight1 = Convert.ToInt32(dr["Weight1"]); if (dr["Cubage1"] != DBNull.Value) main.Cubage1 = Convert.ToInt32(dr["Cubage1"]); if (dr["CargoName"] != DBNull.Value) main.Cargocname = Convert.ToString(dr["CargoName"]); if (dr["Destination"] != DBNull.Value) main.Destination = Convert.ToString(dr["Destination"]); if (dr["Package1"] != DBNull.Value) main.Package1 = Convert.ToString(dr["Package1"]); list.Add(main); } dr.Close(); return list; }
报出:ORA-00918: 未明确定义列
哪位大哥知道错哪里了?
------解决方案--------------------------------------------------------
你检查一下你的字段。
你肯定在2个表里都有相同名字的字段
,给不同表中相同的字段加上表名
仔细检查一下
------解决方案--------------------------------------------------------