Help with sproc to code row returning...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • almurph@altavista.com

    Help with sproc to code row returning...

    Hi,

    I have a stored procedure on SQL Server 2005 which runs a select on 5
    columns. I want to return these rows to the .NET 3.5 C# program.

    I have 2 questions:

    1. In the sproc - do I need an OUTPUT parameter and if yes, what type
    should this be? Or do I just run the select with no OUTPUT parameter?

    2. On the application layer I am using the following to capture the
    output:

    SqlParameter paramOut = new SqlParameter("@ ohlc", SqlDbType.VarCh ar,
    -1);
    paramOut.Direct ion = ParameterDirect ion.Output;
    sqlComm.Paramet ers.Add(paramOu t);


    Problem is though I'm unsure of the type for the SqlDbType parameter?
    I would appreciate any help any can offer me here with this?
    Any comments/suggestions/help would be greatly appreciated.

    Al.
  • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

    #2
    Re: Help with sproc to code row returning...

    almurph@altavis ta.com wrote:
    I have a stored procedure on SQL Server 2005 which runs a select on 5
    columns. I want to return these rows to the .NET 3.5 C# program.
    >
    I have 2 questions:
    >
    1. In the sproc - do I need an OUTPUT parameter and if yes, what type
    should this be? Or do I just run the select with no OUTPUT parameter?
    >
    2. On the application layer I am using the following to capture the
    output:
    >
    SqlParameter paramOut = new SqlParameter("@ ohlc", SqlDbType.VarCh ar,
    -1);
    paramOut.Direct ion = ParameterDirect ion.Output;
    sqlComm.Paramet ers.Add(paramOu t);
    >
    Problem is though I'm unsure of the type for the SqlDbType parameter?
    I would appreciate any help any can offer me here with this?
    Any comments/suggestions/help would be greatly appreciated.
    If you need to return 5 values, then you should return a result set.

    Arne

    Comment

    • DaveL

      #3
      Re: Help with sproc to code row returning...

      SqlCommand cmd = new SqlCommand();
      cmd.CommandText ="SomProc";
      cmd.Parameters. Add("@someParam ",SqlType.Varch ar,30) .Direction =
      System.Data.Par ameterDirection .Output;

      that should help you

      DaveL

      "Arne Vajhøj" <arne@vajhoej.d kwrote in message
      news:48acac67$0 $90264$14726298 @news.sunsite.d k...
      almurph@altavis ta.com wrote:
      >I have a stored procedure on SQL Server 2005 which runs a select on 5
      >columns. I want to return these rows to the .NET 3.5 C# program.
      >>
      >I have 2 questions:
      >>
      >1. In the sproc - do I need an OUTPUT parameter and if yes, what type
      >should this be? Or do I just run the select with no OUTPUT parameter?
      >>
      >2. On the application layer I am using the following to capture the
      >output:
      >>
      >SqlParameter paramOut = new SqlParameter("@ ohlc", SqlDbType.VarCh ar,
      >-1);
      >paramOut.Direc tion = ParameterDirect ion.Output;
      >sqlComm.Parame ters.Add(paramO ut);
      >>
      >Problem is though I'm unsure of the type for the SqlDbType parameter?
      >I would appreciate any help any can offer me here with this?
      >Any comments/suggestions/help would be greatly appreciated.
      >
      If you need to return 5 values, then you should return a result set.
      >
      Arne

      Comment

      Working...