尝试读取或写入受保护的内存。这通常指示其他内存已损坏
求救啊。各位大哥,高手们,请看一下小弟的代码
StringBuilder sb = new StringBuilder();
sb.Append("select l.id as lid, o1.shortname as o1shortname,l.LEG_NO as lLEG_NO,l.EC_NO as lEC_NO,l.CREATE_TIME as lCREATE_TIME, l.BUSINESS_TYPE as lBUSINESS_TYPE,tl.name as tlname,r1.name as r1name,l.plan_no as lplan_no,u.name as uname from legs l ");
sb.Append("left join order_head oh on l.order_id=oh.id ");
sb.Append("left join execute_plan ep on ep.id=oh.execute_plan_id ");
sb.Append("left join EXECUTE_PLAN_TASK ept on ept.execute_plan_id=ep.id ");
sb.Append("left join MONITOR_NODE mn on mn.id=ept.monitor_node_id ");
sb.Append("left join ORGANIZATION o on o.id=ept.execute_platform_id ");
sb.Append("left join ORGANIZATION o1 on o1.id=l.CONSIGNOR_ID ");
sb.Append("left join trans_location tl on tl.id=l.tolocation_id ");
sb.Append("left join ROUTE r1 on r1.id=l.route_id ");
sb.Append("left join USER_ROUTE ur on ur.ROUTE_ID=l.route_id ");
sb.Append("left join users u on u.id=ur.user_id ");
sb.Append("left join GROUP_USER gu on gu.user_id=u.id ");
sb.Append("left join USER_ORGANIZATION uoz on uoz.organization_id=o.id ");
sb.Append("left join USER_ORGANIZATION uoz1 on uoz1.user_id=u.id ");
//以上都是在PL/SQL里写的语句。 可以执行
DataTable dt = new DataTable();
OleDbConnection olc = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["oracleconn"].ConnectionString);
olc.Open();
OleDbDataAdapter oda = new OleDbDataAdapter(sb.ToString(),olc);
oda.Fill(dt);
olc.Close();
但是系统走到oda.Fill(dt); 这里就报错了。尝试读取或写入受保护的内存。这通常指示其他内存已损坏
但是我要是把sb.toString()换一个简单的SQL语句就好了。 怎么办啊? 我就要用这句语句啊。。
在线等!!
StringBuilder sb = new StringBuilder();
sb.Append("select l.id as lid, o1.shortname as o1shortname,l.LEG_NO as lLEG_NO,l.EC_NO as lEC_NO,l.CREATE_TIME as lCREATE_TIME, l.BUSINESS_TYPE as lBUSINESS_TYPE,tl.name as tlname,r1.name as r1name,l.plan_no as lplan_no,u.name as uname from legs l ");
sb.Append("left join order_head oh on l.order_id=oh.id ");
sb.Append("left join execute_plan ep on ep.id=oh.execute_plan_id ");
sb.Append("left join EXECUTE_PLAN_TASK ept on ept.execute_plan_id=ep.id ");
sb.Append("left join MONITOR_NODE mn on mn.id=ept.monitor_node_id ");
sb.Append("left join ORGANIZATION o on o.id=ept.execute_platform_id ");
sb.Append("left join ORGANIZATION o1 on o1.id=l.CONSIGNOR_ID ");
sb.Append("left join trans_location tl on tl.id=l.tolocation_id ");
sb.Append("left join ROUTE r1 on r1.id=l.route_id ");
sb.Append("left join USER_ROUTE ur on ur.ROUTE_ID=l.route_id ");
sb.Append("left join users u on u.id=ur.user_id ");
sb.Append("left join GROUP_USER gu on gu.user_id=u.id ");
sb.Append("left join USER_ORGANIZATION uoz on uoz.organization_id=o.id ");
sb.Append("left join USER_ORGANIZATION uoz1 on uoz1.user_id=u.id ");
//以上都是在PL/SQL里写的语句。 可以执行
DataTable dt = new DataTable();
OleDbConnection olc = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["oracleconn"].ConnectionString);
olc.Open();
OleDbDataAdapter oda = new OleDbDataAdapter(sb.ToString(),olc);
oda.Fill(dt);
olc.Close();
但是系统走到oda.Fill(dt); 这里就报错了。尝试读取或写入受保护的内存。这通常指示其他内存已损坏
但是我要是把sb.toString()换一个简单的SQL语句就好了。 怎么办啊? 我就要用这句语句啊。。
在线等!!
作者: goopoolzl 发布时间: 2011-06-16
将OleDb访问改用SqlClient...
作者: Gene_X 发布时间: 2011-06-16
数据库应该是Oracle,应该用OracleDbConnection。
作者: Liuzhc 发布时间: 2011-06-16
DataTable dt = new DataTable();
System.Data.OracleClient.OracleConnection olc = new System.Data.OracleClient.OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["oracleconn"].ConnectionString);
olc.Open();
System.Data.OracleClient.OracleDataAdapter oda = new System.Data.OracleClient.OracleDataAdapter(sb.ToString(), olc);
oda.Fill(dt);
olc.Close();
System.Data.OracleClient.OracleConnection olc = new System.Data.OracleClient.OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["oracleconn"].ConnectionString);
olc.Open();
System.Data.OracleClient.OracleDataAdapter oda = new System.Data.OracleClient.OracleDataAdapter(sb.ToString(), olc);
oda.Fill(dt);
olc.Close();
作者: Liuzhc 发布时间: 2011-06-16
引用 2 楼 liuzhc 的回复:
数据库应该是Oracle,应该用OracleDbConnection。
数据库应该是Oracle,应该用OracleDbConnection。
为什么我在UI层这里用不了这个选项~~~ 添加引用里面也没有~~
作者: goopoolzl 发布时间: 2011-06-16
引用 4 楼 goopoolzl 的回复:
引用 2 楼 liuzhc 的回复:
数据库应该是Oracle,应该用OracleDbConnection。
为什么我在UI层这里用不了这个选项~~~ 添加引用里面也没有~~
你的添加的程序集对吗?
引用 2 楼 liuzhc 的回复:
数据库应该是Oracle,应该用OracleDbConnection。
为什么我在UI层这里用不了这个选项~~~ 添加引用里面也没有~~
作者: xuexiaodong2009 发布时间: 2011-06-16