0

当我尝试在“描述”字段中向记录集插入一个值时。它显示一个错误,如

运行时错误“-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 个字符。

请告诉如何增加记录集中字段的大小/长度。

4

2 回答 2

3

如果该字段的长度为 50 个字符,则必须将 DB 对该字段的定义从 50 更改为您需要的任何值。你不能通过记录集做到这一点

于 2013-03-20T13:43:02.950 回答
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"

这应该将记录集中描述字段的长度设置为 100 个字符。您也可以在其他数据库平台上执行此操作,但CAST.

于 2014-07-22T13:56:45.437 回答