Stored procedure not returning anything

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • macupryk
    New Member
    • Sep 2006
    • 24

    Stored procedure not returning anything

    Returns nothing?

    private DataSet DoQuery()
    {
    DataSet ds = null;
    SqlConnectionSt ringRG_Study = ConfigService.I nstance.GetStri ng("RG10_Study" );

    try
    {
    VxDbClient _dbClient = new VxDbClient();
    VxDbConnection _connection = new VxDbConnection( VxDbType.Sql, SqlConnectionSt ringRG_Study);
    _dbClient.Conne ctionString = _connection.Con nectionString;

    ds = _dbClient.Execu teStoredProc("R g_sp_GetReportL ist", null);

    return ds;

    }
    catch (Exception ex)
    {
    throw ex;
    }

    }


    set QUOTED_IDENTIFI ER ON
    go

    public DataSet ExecuteStoredPr oc (string spName, VxDbParameter [] Params)
    {
    DataSet ds = null ;
    bool bWasOpen = true ;

    if (_adapter != null)
    _adapter.Dispos e() ;
    _adapter = null ;
    if (_cmd != null)
    _cmd.Dispose() ;
    _cmd = null ;

    if (false == CheckSetConnect ion())
    return (null) ;

    try
    {
    _cmd = new VxDbCommand (spName, _connection) ;
    _cmd.Transactio n = _transaction;
    _cmd.CommandTim eout = CMD_TIMEOUT ;
    _cmd.CommandTyp e = CommandType.Sto redProcedure ;

    if (Params != null)
    {
    for (int i = 0 ; i < Params.Length ; i++)
    {
    _cmd.Parameters .Add (Params[i]) ;
    }
    }
    if (_connection.St ate != ConnectionState .Open)
    {
    bWasOpen = false ;
    _connection.Ope n() ;
    }
    _adapter = new VxDataAdapter (_cmd) ;
    ds = new DataSet () ;
    _adapter.Fill (ds) ;
    if (false == bWasOpen)
    {
    _connection.Clo se() ;
    bWasOpen = true ;
    }
    }
    catch
    {
    if (ds != null)
    ds.Dispose() ;
    throw;
    }
    finally
    {
    if (false == bWasOpen)
    _connection.Clo se() ;
    if (_adapter != null)
    {
    _adapter.Dispos e() ;
    }
    }
    return (ds) ;
    }

    this.bindingSou rce1.DataSource = DoQuery();
    this.ultraGridD ashBoard.DataSo urce = bindingSource1;


    ALTER PROCEDURE [dbo].[Rg_sp_GetReport List]

    AS
    BEGIN
    SET NOCOUNT ON

    SELECT ReportId, ReportName, ReportDefinitio n
    from Report

    END
  • bharathreddy
    New Member
    • Aug 2006
    • 116

    #2
    Hai,

    I think you are not setting the parameter type : Input/Output/InputOutput.

    _cmd.Parameters .Add (Params[i]) ;

    Here it is not showing any parameter type. By default it is Input. If u want the storedprocedure to return any value then that parameter type should be either Output or InputOutput.

    Note : Input means which are input to the storedprocedure .
    Output means which is output form the storedprocedure .
    InputOutput means both it acts as input and output to sp.

    Comment

    Working...