Metodo ExecuteScalar()
restituisce System.Object
quindi cambia il tuo codice.
Dim value=cmd2.ExecuteScalar()
IF Not IsNoThing(value) Then
result=Decimal.Parse(value.ToString())
End IF
Oppure puoi usare ExecuteReader,
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
E sempre usa i parametri invece della stringa sql codificata.
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
.....