Forums
This topic is locked
Caling a PL/SQL function from ASP.NET (VB)
Posted 24 Sep 2003 13:48:32
1
has voted
24 Sep 2003 13:48:32 Penny Penny posted:
Hi everybody,I don't understand why i can't retrieve the result of my pl/sql function into my asp.net script.
My pl/sql function is:
CREATE OR REPLACE FUNCTION test
RETURN number
AS
nb NUMBER;
BEGIN
nb:=4;
RETURN nb;
END;
------------------------------
My ASP.net script is:
<script language="VB" runat="server">
sub page_load (source as object, e as eventArgs)
dim connstring As string ="provider=MSDAORA;" & "SERVER=tiger;User ID=tiger;Password=penny;DATABASE=MADB"
dim conn As New OleDbConnection
conn.ConnectionString=connstring
conn.open()
dim cmd As New OleDbCommand("test",conn)
cmd.commandType=commandType.StoredProcedure
dim prmNumRows as new OleDbParameter
prmNumRows=cmd.CreateParameter()
prmNumRows.Direction = ParameterDirection.Returnvalue
prmNumRows.DbType = DbType.Int16
cmd.Parameters.Add(prmNumRows)
'Retrieve and display value
dim objReturnValue as integer= cmd.ExecuteScalar()
response.write ("Number retrieved: " & objReturnValue)
end sub
</script>
-------------------------------------------
This script always display: "Number retrieved: 0" instead of "Number retrieved: 4".
Can someone help me?
thanks a lot.