Provider error '8002000a'
Out of present range.
(and the line number)
This typically happens when trying to pass a value that is too large for the data type when using an ADODB.Connection.
But the code where it was failing was pretty simple:
sSQL = "update ARTICLE set AR_DISPLAY=0 where AR_TYPE='R'"
Call adoConn.Execute(sSQL, lRecords)
It was hard to see how this could involve any overvalued types until I tried the query in SSMS and it reported: 33826 row(s) affected. The suspicion now was that the number of records being return was too big for the lRecords value, so it must be an Integer. As it's not possible to explicitly declare this as a Long, the solution was to use a function to covert it before running the query, as below: -
lRecords = CLng(0)
sSQL = "update ARTICLE set AR_DISPLAY=0 where AR_TYPE='R'"
Call adoConn.Execute(sSQL, lRecords)
No comments:
Post a Comment