Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003

    Unanswered: Procedure calling from C#


    Maybe this is not the best place to post this kind of questions, but I'm gonna try it anyway.
    I have a PL/SQL package in Oracle 8.1.4, that I would like to access with a C# program I am making.
    A sample of my code is:

    ADODB.Command comm = new ADODB.Command();
    ADODB.Parameter param1 = new ADODB.Parameter();
    ADODB.Parameter param2 = new ADODB.Parameter();
    ADODB.Parameter param3 = new ADODB.Parameter();
    comm.ActiveConnection = cn;
    comm.CommandText = "PROCEDURE_NAME";
    comm.CommandType = CommandTypeEnum.adCmdStoredProc;
    param1 = comm.CreateParameter("i_param1",DataTypeEnum.adNum eric,ParameterDirectionEnum.adParamInput, 500, -1);
    param2 = comm.CreateParameter("i_param2",DataTypeEnum.adNum eric,ParameterDirectionEnum.adParamInput, 500, -1);
    param3 = comm.CreateParameter("i_param3",DataTypeEnum.adNum eric,ParameterDirectionEnum.adParamInput, 500, -1);
    comm.Parameters.Append (param1);
    comm.Parameters.Append (param2);
    comm.Parameters.Append (param3);
    comm.Parameters["i_param1"].Value = 12;
    comm.Parameters["i_param2"].Value = 2005;
    comm.Parameters["i_param3"].Value = 2005;

    Ok ... when I try to make comm.EXECUTE, C# wants me to put 3 arguments in EXECUTE command.
    comm.EXECUTE (out object RecordsAffected, ref object Parameters, int Options)
    In Visual Basic 6, that was not needed ... and therefor I dont know what do put in there.

    Any Idea ??


  2. #2
    Join Date
    May 2004
    Dominican Republic
    perhaps comm.EXECUTE null, null, null ? the thing is, if procedure_name happens to be a dml, you will have how many records were affected in RecordsAffected, Parameters would be an array with all the parameters for this procedures.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts