Nonspecific behavior of a record set in vb6

Dear expert! I have the following problem when I try to get a value from a recordset showing an error request

SSql = "select doj, dol, employeeid from m_employee, where employeeid = '" and Trim (code RsCardNo!) And "'" rsCardRepl.Open SSql, Conn, adOpenDynamic, adLockOptimistic
If rsCardRepl.RecordCount> 0 Then Dim temp As Integer temp = Trim (rsCardRepl! EmployeeId) rsAddPunch! PAYCODE = temp End If

Then the next line giving an error

temp = Trim (rsCardRepl! employeeId)

Error Number = 6 Error Description = Overflow

Please explain to me why this error is appropriate and what is the solution.

Thanks Sea Kishore Pandey

+4
source share
2 answers

try using the adOpenForwardOnly cursor type and the adLockReadOnly lock type

+2
source

You may need to define temp like this. Dim temp As Long

In simple words, an overflow error means that the value will not fit into the variable.

  • VB6 Integer can take values ​​from -32.768 to 32.767
  • A Long can take values ​​from -2,147,483,648 to 2,147,483,647
0
source

All Articles