Error while calling oracle sp in C# dot net

I am getting below error, when trying to specify input parameters for executing oracle sp from C#.there is nothing wrong with the procedure or parameter names.Able to execute the proc from sql developer client.And i already cross checked name mismatch for parameters specified.All are ok.I am using dot net framework 4.0. with oracle 10g.I am using reference of microsoft.practices.enterpriselibarry.Common, microsoft.practices.enterpriselibarry.Data and microsoft.practices.enterpriselibarry.Data.Sqlce whose verion is 5.0.414.0 and runtime version is v2.0.50727.


stack trace :
        Description: An OracleParameter with ParameterName 'test1' is not contained by this OracleParameterCollection.
        StackTrace:  
           at System.Data.OracleClient.OracleParameterCollection.GetParameter(String parameterName)
   at System.Data.Common.DbParameterCollection.get_Item(String parameterName)
   at Microsoft.Practices.EnterpriseLibrary.Data.Database.SetParameterValue(DbCommand command, String parameterName, Object value)
   at Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase.SetParameterValue(DbCommand command, String parameterName, Object value)
   at Helpers.DataAccessOracle.GetData(String test1, String test2,String test3) in .......DataAccessOracle.cs:line 120
       
code:

public Response GetData(String test1, String test2,String test3)
        {
         
            string oraConnectionString = string.Empty;
            string paramName = "dbname";
            dataresponseres = null;
            try
            {
               
                    oraConnectionString = DataAccessHelper.GetOracleCredential(paramName);
                    oradefault = new OracleDatabase(oraConnectionString);
               
                using (DbCommand dbCommand = oradefault.GetStoredProcCommand("getdata"))
                {
                    oradefault.DiscoverParameters(dbCommand);

                    oradefault.SetParameterValue(dbCommand, "dbparamtest1", test1); <-- line 120 with issue
DevildibAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
1) You should download and install the Oracle ODAC version for the database that you are connecting to.
 
     The namespace is Oracle.DataAccess

   The Microsoft System.Data.OracleClient was deprecated.

2) With Oracle ODAC, you add OracleParameter parameters to the OracleCommand.
Guy Hengel [angelIII / a3]Billing EngineerCommented:
just to make sure:

error writes:
... ParameterName 'test1' is not contained ...

the relevant code :
 oradefault.SetParameterValue(dbCommand, "dbparamtest1", test1); <-- line 120 with issue

hence:
"dbparamtest1" is <> from "test1" ... which makes me suggest to change to:
 oradefault.SetParameterValue(dbCommand, "test1", test1); <-- line 120 with issue

maybe it's too obvious, but I prefer to rule that one out before trying to get deeper into some issues...
DevildibAuthor Commented:
I am sorry.the parameter naming , i had tweaked it for not revealing project code nomenclatures.so, pls assume that naming of the prameters is ok.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

DevildibAuthor Commented:
And rest everywhere in my project oracle calls are working fine.why this issue only on a particular page??
DevildibAuthor Commented:
also, deprecated means its unsupported,but can be used.i understand that odo.net is free and us fast.but i need to get to the root of this error.pls help
Bob LearnedCommented:
What list of parameters do you get back from "oradefault.DiscoverParameters(dbCommand)"?

How are you adding the parameters?
DevildibAuthor Commented:
Unable to debug that part as of now.but even if i comment that line i.e. Databasename.discoverparameters, i still get the same error
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>but even if i comment that line
the question was not to comment that line out, but after calling that line, to list the parameters in the parameters collection.
usually, there you can see what the issue might be.

for example, working with oracle, the parameter names might be case sensitive (TEST1 might then work)
Bob LearnedCommented:
Well, you don't need to debug that part just now--it might help to find the relevant part of the code that shows how you are adding parameters.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DevildibAuthor Commented:
Hi.it got resolved.i got this working by changing the ado.net part all together to a more traditional way like cmd. Add parameters .... Instead of discovering parameters and setting parameter values later.thanks anyways.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.