实时错误 '-2147217833..String data,right truncation.....问题:遇到问题了,上面是不是说字符串太长了,正确切断?但是我表里字段长度足够!函数代码如下:报错地点:objCom.execute
Private Sub RunStoreProc(StoreProcName As String, vfpRSValue() As String)
'on error goto ErrMsg
If StoreProcName = "" Then
Exit Sub
End IfDim objCom As ADODB.Command
Set objCom = New ADODB.Command
With objCom
.ActiveConnection = odata.oCn '数据库连接未使用参数传递~~~已全局
.CommandText = StoreProcName
.CommandType = adCmdStoredProc
'.CommandTimeout=10000000
End WithDim objParam0 As ADODB.Parameter
Set objParam0 = New ADODB.Parameter
With objParam0
.Name = "@strMZH"
.Type = adVarChar
.Size = 10
.Direction = adParamInput
.Value = vfpRSValue(0)
End With
objCom.Parameters.Append objParam0Dim objParam1 As ADODB.Parameter
Set objParam1 = New ADODB.Parameter
With objParam1
.Name = "@strPZBH"
.Type = adVarChar
.Size = 17
.Direction = adParamInput
.Value = vfpRSValue(1)
End With
objCom.Parameters.Append objParam1Dim objParam2 As ADODB.Parameter
Set objParam2 = New ADODB.Parameter
With objParam2
.Name = "@strCZR"
.Type = adVarChar
.Size = 4
.Direction = adParamInput
.Value = vfpRSValue(2)
End With
objCom.Parameters.Append objParam2Dim objParam3 As ADODB.Parameter
Set objParam3 = New ADODB.Parameter
With objParam3
.Name = "@strRQ"
.Type = adVarChar
.Size = 9
.Direction = adParamInput
If Len(vfpRSValue(3)) = 6 Then
.Value = vfpRSValue(3) + "01"
Else
.Value = ""
End IfEnd With
objCom.Parameters.Append objParam3objCom.Execute '注意!报错地放~~!!!'Set objCom = Nothing'ErrMsg:
'Exit Function
End Sub
Private Sub RunStoreProc(StoreProcName As String, vfpRSValue() As String)
'on error goto ErrMsg
If StoreProcName = "" Then
Exit Sub
End IfDim objCom As ADODB.Command
Set objCom = New ADODB.Command
With objCom
.ActiveConnection = odata.oCn '数据库连接未使用参数传递~~~已全局
.CommandText = StoreProcName
.CommandType = adCmdStoredProc
'.CommandTimeout=10000000
End WithDim objParam0 As ADODB.Parameter
Set objParam0 = New ADODB.Parameter
With objParam0
.Name = "@strMZH"
.Type = adVarChar
.Size = 10
.Direction = adParamInput
.Value = vfpRSValue(0)
End With
objCom.Parameters.Append objParam0Dim objParam1 As ADODB.Parameter
Set objParam1 = New ADODB.Parameter
With objParam1
.Name = "@strPZBH"
.Type = adVarChar
.Size = 17
.Direction = adParamInput
.Value = vfpRSValue(1)
End With
objCom.Parameters.Append objParam1Dim objParam2 As ADODB.Parameter
Set objParam2 = New ADODB.Parameter
With objParam2
.Name = "@strCZR"
.Type = adVarChar
.Size = 4
.Direction = adParamInput
.Value = vfpRSValue(2)
End With
objCom.Parameters.Append objParam2Dim objParam3 As ADODB.Parameter
Set objParam3 = New ADODB.Parameter
With objParam3
.Name = "@strRQ"
.Type = adVarChar
.Size = 9
.Direction = adParamInput
If Len(vfpRSValue(3)) = 6 Then
.Value = vfpRSValue(3) + "01"
Else
.Value = ""
End IfEnd With
objCom.Parameters.Append objParam3objCom.Execute '注意!报错地放~~!!!'Set objCom = Nothing'ErrMsg:
'Exit Function
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货