hello, i want to ask why my function cant be called
here's the function
create or replace function hitung_denda (idPinjam number, tggl varchar2) return number is
denda number;
tgl1 date;
tgl date;
begin
select tgl_batas into tgl1 from peminjaman where id_pinjam=idPinjam;
tgl:=to_date (tggl, 'MM/DD/YYYY');
if tgl>tgl1 then
select (tgl-tgl_batas)*1000 into denda from peminjaman where id_pinjam=idPinjam;
else
denda:=0;
end if;
return denda;
exception
when no_data_found then
return -1;
end;
and here's my vb code
Private Sub TextBox3_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox3.TextChanged
Try
Dim con As New OleDbConnection
con.ConnectionString = "provider=msdaora; data source=xe; user id=hr; password=hr;"
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand("hitung_denda", con)
cmd.CommandType = CommandType.StoredProcedure
Dim returnval As New OleDbParameter("retval", OleDbType.Decimal, 100, ParameterDirection.ReturnValue, True, 0, 0, "retval", DataRowVersion.Current, vbNull)
cmd.Parameters.Add("idPinjam", OleDbType.Decimal, 5).Value = CInt(TextBox3.Text)
cmd.Parameters.Add("tgl", OleDbType.VarChar, 40).Value = DateTimePicker1.Text
Dim denda As Integer
denda = returnval.Value
Label8.Text = CStr(denda)
con.Close()
con.Dispose()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "")
End Try
End Sub
i'm looking forward for your help.. Thanks