当我尝试在“描述”字段中向记录集插入值时。它显示错误,如
运行时错误'-2147217887(80040e21)' 多步操作产生错误。检查每个状态值。
sql = "SELECT * FROM vePODetail WHERE vePOID=" & Str(ado_veReceive.Recordset("vePOID")) & " ORDER BY vePODetailID"
rs.ActiveConnection = g_cnnCompany
rs.Open sql
Do While Not rs.EOF
ado_veReceiveDetailWF.Recordset.AddNew
ado_veReceiveDetailWF.Recordset("vePODetailID") = rs("vePODetailID")
ado_veReceiveDetailWF.Recordset("prMasterID") = rs("prMasterID")
ado_veReceiveDetailWF.Recordset("Description") = rs("Description")
ado_veReceiveDetailWF.Recordset("QuantityReceived") = rs("QuantityOrdered") -rs("QuantityReceived")
ado_veReceiveDetailWF.Recordset.Update
rs.MoveNext
Loop
rs.Close
记录集中的字段仅接受50个字符。
请告诉我们如何增加记录集中字段的大小/长度。
答案 0 :(得分:2)
如果字段长度为50个字符,则必须将字段的DB定义从50更改为您需要的任何字符。你不能通过记录集
来做到这一点答案 1 :(得分:0)
假设您正在使用SQL Server,则可以使用CAST
操作更改查询:
sql = "SELECT vePODetailID,prMasterID,CAST(Description as VARCHAR(100)) AS Description, QuantityReceived FROM vePODetail WHERE vePOID=" & Str(ado_veReceive.Recordset("vePOID")) & " ORDER BY vePODetailID"
这应该将记录集中Description字段的长度设置为100个字符。您也可以在其他数据库平台中执行此操作,但CAST
的语法可能不同。