Methode ExecuteScalar()
retourneert System.Object
dus verander je code.
Dim value=cmd2.ExecuteScalar()
IF Not IsNoThing(value) Then
result=Decimal.Parse(value.ToString())
End IF
Of u kunt ExecuteReader gebruiken,
Dim dr2 As OracleDataReader = cmd2.ExecuteReader()
Dim value as Decimal
If dr2.Read() Then
IF Not dr2.IsDbNull(0)
Value=dr2.GetDecimal(0)
End IF
End If
En altijd gebruik parameters in plaats van hardcoded sql string.
cmd2.CommandText = "SELECT MAX(LASTNO) FROM d001005 where [email protected] and CODE1='CASH' and [email protected]"
cmd2.Parameters.Add("@lbrcode",SqlDbType.VarChar,20).Value=lbr
.....