Method ExecuteScalar()
returns System.Object
so change your code.
Dim value=cmd2.ExecuteScalar()
IF Not IsNoThing(value) Then
result=Decimal.Parse(value.ToString())
End IF
Or you can use 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
And always use parameters instead of hardcoded sql string.
cmd2.CommandText = "SELECT MAX(LASTNO) FROM d001005 where lbrcode=@lbrcode and CODE1='CASH' and lnodate=@lnodate"
cmd2.Parameters.Add("@lbrcode",SqlDbType.VarChar,20).Value=lbr
.....
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…