Metode ExecuteScalar()
mengembalikan System.Object
jadi ubah kode Anda.
Dim value=cmd2.ExecuteScalar()
IF Not IsNoThing(value) Then
result=Decimal.Parse(value.ToString())
End IF
Atau Anda dapat menggunakan 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
Dan selalu gunakan parameter alih-alih string sql hardcoded.
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
.....