解决多步OLE DB 操作产生错误。

最近做国土系统的时候出现:
Microsoft OLE DB Provider for SQL Server 错误 '80040e21'
多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。
======================================
引起这个问题的原因简单的说就是数据库的字段类型不匹配或者字符个数超出了数据库的字段的最大限制个数。

例如自动编号字段的就不应该指定值;限制50个字符的字段你就不应该提交多于50个字符的字符串。

多步OLE DB操作产生错误

12-08

代码如下:rn ....rn sql_reader="select 商家编码,商家名称,case when 单据日期 between '2006-11-25' and '2006-11-30' then '2006-11-25至2006-11-30' else '2006-12-01至2006-12-08' end as 时间段,产品编码,产品名称,规格型号,convert(varchar(100),sum(数量)) as 数量,convert(varchar(100),sum(金额)) as 金额 from view_Rpt_S_cp_sale where 单位顺序=1 and ( (站点号 like '1013%') or (站点号 like '1014%') or (站点号 like '1015%') or (站点号 like '1018%') ) and ((单据日期 between '2006-11-25' and '2006-11-30') or (单据日期 between '2006-12-01' and '2006-12-08') ) and ( 客户类型=1) and ( (产品分类编码 like '010101%') ) group by 商家编码,商家名称,case when 单据日期 between '2006-11-25' and '2006-11-30' then '2006-11-25至2006-11-30' else '2006-12-01至2006-12-08' end ,产品编码,产品名称,规格型号 union select 商家编码+'小计','','','','','',convert(varchar(100),sum(数量)) as 数量,convert(varchar(100),sum(金额)) as 金额 from view_Rpt_S_cp_sale where 单位顺序=1 and ( (站点号 like '1013%') or (站点号 like '1014%') or (站点号 like '1015%') or (站点号 like '1018%')rn ) and ((单据日期 between '2006-11-25' and '2006-11-30') or (单据日期 between '2006-12-01' and '2006-12-08') ) and ( 客户类型=1) and ( (产品分类编码 like '010101%') ) group by 商家编码 union select '总计','总计','总计','总计','总计','总计',convert(varchar(100),sum(数量)) as 数量,convert(varchar(100),sum(金额)) as 金额 from view_Rpt_S_cp_sale where 单位顺序=1 and ( (站点号 like '1013%') or (站点号 like '1014%') or (站点号 like '1015%') or (站点号 like '1018%') ) and ((单据日期 between '2006-11-25' and '2006-11-30') or (单据日期 between '2006-12-01' and '2006-12-08') ) and ( 客户类型=1) and ( (产品分类编码 like '010101%') ) order by 商家编码rn"rn myconn.Open conn '打开数据链接rn Dim myreader As ADODB.Recordsetrn Set myreader = New ADODB.Recordsetrn With myreaderrn .ActiveConnection = myconnrn .Open sql_reader, , 1, 1 rn ......rnrnrn执行到 .Open sql_reader, , 1, 1 时,出错:多步OLE DB操作产生错误?如果可能,请检查每个ole db 状态值。没有工作被完成。rnrn这是个什么错误??rn同样的select语句,在查询分析器里执行,却是正确的。rn

多步 OLE DB 操作产生错误,急急!

02-09

代码如下:rnrn<% if session.contents("jiben_right")="1" then %>rnrnrn<% dim need,supplier,supplier_name,postion,pay_out,qixian,rs,strsql,rec,sql,ht_date,input_namerndim id,rstemp1,sqltemp1,good,tiao_three,tiao_sixrndim rstemp,sqltemp,leibie,tiao_two,tiao_four,tiao_serven,lb_yuanliaorndim rslast,sqllast,ht,tiao_one,tiao_five,tiao_eight,tiao_nine,pay_per,qita,bumenrn rn rn supplier=trim(request("supplier"))rn supplier_name=trim(request("supplier_name"))rn postion=trim(request("postion"))rn pay_out=trim(request("pay_out"))rn rn need=trim(request("need"))rn qixian=trim(request("qixian"))rn tiao_one=trim(request("tiao_one"))rn tiao_two=trim(request("tiao_two"))rn tiao_three=trim(request("tiao_three"))rn tiao_four=trim(request("tiao_four"))rn tiao_five=trim(request("tiao_five"))rn tiao_six=trim(request("tiao_six"))rn tiao_serven=trim(request("tiao_serven"))rn tiao_eight=trim(request("tiao_eight"))rn tiao_nine=trim(request("tiao_nine"))rn pay_per=trim(request("pay_per"))rn qita=trim(request("qita"))rn if supplier="" thenrn response.write " "rn response.endrn end ifrn if need="" thenrn response.write " "rn response.endrn end ifrn if qita="" thenrn response.write " "rn response.endrn end ifrn set rstemp=server.createobject("ADODB.recordset") rn sqltemp = "Select leibie From supplier where supplier='"&trim(request("need"))&"' and other='原料'"rn rstemp.open sqltemp, conn,1,3rn if not rstemp.eof thenrn lb_yuanliao=rstemp("leibie")rn end ifrn rstemp.closern set rslast=server.createobject("ADODB.recordset")rn sqllast = "Select id From hetong where id=(select max(id) from hetong)"rn rslast.open sqllast, conn,1,3rn if not rslast.eof thenrn good=rslast("id")rn end ifrn rslast.closern set rec=server.createobject("ADODB.recordset") rn rec.Open "SELECT * FROM hetong where id is null",conn,1,3rn rec.AddNewrn rec("supplier")=supplierrn rec("supplier_name")=supplier_namern rec("postion")=postionrn rec("pay_out")=pay_outrn rec("need")=needrn rec("qixian")=qixianrn rec("ht_date")=date()rn rec("input_name")=session("username")rn rec("zhuangtai")="未审核"rn response.write"lb_yuanliao&date()&good"rn rec("hetong_no")=lb_yuanliao&date()&goodrn rec("tiao_one")=tiao_onern rec("tiao_two")=tiao_tworn rec("tiao_three")=tiao_threern rec("tiao_four")=tiao_fourrn rec("tiao_five")=tiao_fivern rec("tiao_six")=tiao_sixrn rec("tiao_serven")=tiao_servenrn rec("tiao_eight")=tiao_eightrn rec("tiao_nine")=tiao_ninern rec("pay_per")=pay_perrn rec("qita")=qitarn rec("leibie")="原料"rn rec("modify")="否"rn rec("bumen")=session("bumen")rn rec.updaternrn%>rnrnrn 云蝠集团测试管理系统rnrn rn rnrnrnrnrn rn rnrn rn rn rn rnrn rn <%rn Response.Write " 订单号为:"&rec("hetong_no")&"的详细信息已经成功添加 "rn Response.Write "请记住该订单号返回"rn rec.closern set rec=nothingrn %>rnrnrnrnrnrnrnrn <%elsern %>rn rn<%rnend ifrnconn.ClosernSet Conn=Nothingrn%>

再发:多步 OLE DB 操作产生错误

03-05

开发语言:C#+WinForm rn出错位置:强类型的DataSet读取时 rn运行平台:在XP下开发,在xp下运行正常,在vista下出现此错误 rn数据库是Access2000,在网上查到的原因大都是插入数据是类型不对或长度超长,但我这里只是读一下数据库为什么就出错了呢?还有就是在XP下一点问题也没有rn数据库中只有一条记录,强类型DataSet执行的是 select id,memo,.... from db rn这是我的测试源码,有用vista的朋友能否帮我试一下,谢谢 rnhttp://www.hinfo.cn/WindowsApplication1.rarrn出错信息: rn************** 异常文本 ************** rnSystem.Data.OleDb.OleDbException: 多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。 rn 在 System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper) rn 在 System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) rn 在 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) rn 在 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) rn 在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) rn 在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) rn 在 System.Data.OleDb.OleDbConnection.Open() rn 在 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) rn 在 System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) rn 在 System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) rn 在 DbAccess.DataSetFanTableAdapters.FanUserTableAdapter.GetDataById(String guid) rn 在 xFan.UserInfoClass.GetData(String userID) rn 在 xFan.FrmSplash.FrmSplash_Load(Object sender, EventArgs e) rn 在 System.Windows.Forms.Form.OnLoad(EventArgs e) rn 在 System.Windows.Forms.Form.OnCreateControl() rn 在 System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) rn 在 System.Windows.Forms.Control.CreateControl() rn 在 System.Windows.Forms.Control.WmShowWindow(Message& m) rn 在 System.Windows.Forms.Control.WndProc(Message& m) rn 在 System.Windows.Forms.ScrollableControl.WndProc(Message& m) rn 在 System.Windows.Forms.ContainerControl.WndProc(Message& m) rn 在 System.Windows.Forms.Form.WmShowWindow(Message& m) rn 在 System.Windows.Forms.Form.WndProc(Message& m) rn 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) rn 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) rn 在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试