Help on Calling Stored Procedure

techieit

New member
Joined
Aug 23, 2005
Messages
4
Programming Experience
1-3
hi all !

i have a problem with stored procedures.
i have wriiten a stored procedure that does some calculation . The procedure needs to called from the Front End .
Procedure is present on a oracle database.

the function executes without any error / problems but required action i suppose is not performed. procedure takes a single date variable as parameter.
The code is as follows:
VB.NET:
   Dim cm As OleDb.OleDbCommand
		cm = New OleDb.OleDbCommand
		cm.CommandType = CommandType.StoredProcedure
		cm.CommandText = "%%procname%%"
		cm.Connection = fmainform.GetConnection// here the connnection	 //with database is estblished

		Dim cmm As OleDb.OleDbParameter
		cmm = New OleDb.OleDbParameter
		cmm.ParameterName = "@tdate"
		cm.Parameters.Add(cmm)

		Dim reader As OleDb.OleDbDataReader
		cm.Parameters("@tdate").Value = "01-aug-2005"
		cm.ExecuteNonQuery()


the procedure is correct coz , when i execute the querry from sqlplus of oracle , its done properly. but same does not happen..
please help

thanks in advace
gk,
mumbai,India
 
I don't see a problem right away but I do notice you are using the rather simple OleDB dataproviders to access your Oracle Database. It would be better to use ODP.NET (Oracle Dataprovider for .Net) This provider has got some special features built in for working with Oracle Db's. It's also published by Oracle Corp. themselves. Perhaps it will work then? :)

ODP.Net --> http://www.oracle.com/technology/tech/windows/odpnet/index.html
 
A couple of things:
1) Is the name of the procedure really "%%procname%%"? I ask only because I know that in SQL Server that would be an invalid proc name. Oracle maybe different, so I'm asking.
2) What are you execting to happen? I see that you also defined a DataReader, but never use it.

The only other thing I can think of is that you may want to also set the DataType of the parameter too.

Other than that, the codel ooks fine to me.

-tg
 
Back
Top