DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004
    Location
    asdf
    Posts
    24

    Exclamation Problem calling a function from asp.net

    Below is code that I thought would run a function from asp.net passing it one argument, an id and return one number an integer
    as well. I am able to call stored procedures from asp.net with code similar to below but those procedures added
    a row of data to the table. I'm wondering is the procedure slightly different when you try to call a
    function instead of a stored procedure. I would have thought not since people seem to assume that stored procedures
    cover both stored procedures and functions. This is the error that I get when I try to call the function

    Oracle.DataAccess.Client.OracleException ORA-06550: line 1, column 7: PLS-00221: 'COUNTROW' is not a procedure or is undefined ORA-06550: line 1, column 7: PL/SQL: Statement ignored at Project1.xmlApp.GetInt(String[] aParams) in c:\inetpub\wwwroot\project1\xmlapp.aspx.cs:line 273 at Project1.xmlApp.btnRead_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\project1\xmlapp.aspx.cs:line 171


    Any help is greatly appreciated.




    namespace Project1
    {
    /// <summary>
    /// Summary description for WebForm1.
    /// </summary>
    public class xmlApp: System.Web.UI.Page
    {


    private void Page_Load(object sender, System.EventArgs e)
    {

    /**if(inFileLocation.Value == "")
    {
    btnRead.Enabled = false;
    lblfileLoc.Visible = true;
    }
    if(inFileLocation.Value != "")
    {
    btnRead.Enabled = true;
    lblfileLoc.Visible = false;
    }
    **/
    lblErrors.Visible = false;
    lblErrors2.Visible = false;
    lblErrors3.Visible = false;
    lblErrors4.Visible = false;
    lblErrors5.Visible = false;

    }


    GetInt(arguments);





    //****************************************************************


    }//End of try block

    catch(XmlException eff)
    {


    lblErrors4.Visible = true;
    lblErrors4.Text ="File not validated"+"</br>" + eff.ToString();
    }

    catch (Exception eg)
    {
    lblErrors5.Visible = true;
    lblErrors5.Text ="Please enter a file path"+"</br>"+ eg.ToString();
    }




    }//End of read method

    /// <summary>
    /// Method that is called to execute a stored procedure against the database and return a DataSet.
    /// </summary>
    /// <param name="aParams">A set or parameters to populate the command object.</param>
    /// <returns>A dataset containing the results of the stored procedure.</returns>
    ///


    public int GetInt(string[] aParams)
    {
    string sConn = GetConnString();

    OracleConnection objConn = new OracleConnection(sConn);
    OracleCommand objCmd;

    int iResult;

    try
    {

    PopulateCommand(aParams,out objCmd);

    objCmd.Connection=objConn;
    objConn.Open();

    iResult = Convert.ToInt32(objCmd.ExecuteScalar().ToString());

    }
    catch (Exception ex)
    {
    throw ex;
    }
    finally
    {
    objConn.Close();
    }

    return iResult;

    }




    //****************************************************************************************** *****
    private void PopulateCommand(string[] aParams,out OracleCommand objCmd)
    {
    objCmd = new OracleCommand();

    objCmd.CommandType=CommandType.StoredProcedure;


    OracleParameter param;

    for (int i=0;i< aParams.Length;i++)
    {
    String par = aParams[i];
    if (i==0)
    {
    objCmd.CommandText= aParams[0];
    Response.Write("<br>"+"<br>"+"<br>"+"<br>"+"<br>"+aParams[0]);


    }//End if.

    else
    {
    String args = aParams[i];

    param = new OracleParameter(args,OracleDbType.Varchar2);

    param.Direction = ParameterDirection.Input;

    param.Value = args;



    Response.Write("<br>"+"<br>"+"<br>"+"<br>"+"<br>"+param);

    objCmd.Parameters.Add(param);

    }//End else.

    }//End for loop.

    }//End PopulateCommand method.


    //****************************************************************************************** *******



    }
    asdf

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    The error seems to be coming from the Oracle side so I can't see how the .NET code would affect this.

    Does the Oracle user ID you're using to connect with have sufficient permissions to access this procedure?
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Nov 2004
    Location
    asdf
    Posts
    24
    Ya becuase using some similar code i am able to execute procedures that add a row of data to the table. The problem has arisen because i have tried to deal with functions instead of procedures
    asdf

Similar Threads

  1. Getting a GUI to run
    By Eric in forum Java
    Replies: 4
    Last Post: 04-14-2006, 09:09 AM
  2. Packed Data(Comp-3, etc)
    By Marcos in forum VB Classic
    Replies: 3
    Last Post: 01-25-2006, 11:18 AM
  3. VB6 vs VB.NET...Procedure Calling Syntax
    By Patrick Troughton in forum .NET
    Replies: 78
    Last Post: 08-13-2002, 11:18 AM
  4. linker error while calling a c function from VC++ application
    By hai wang in forum authorevents.morrison
    Replies: 1
    Last Post: 11-17-2000, 10:21 AM
  5. I am helpless - Edit Info form
    By Dan in forum VB Classic
    Replies: 0
    Last Post: 03-17-2000, 05:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links