Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
AnswerRe: Looking for a specific regex Pin
Pete O'Hanlon8-Jan-13 22:27
mvePete O'Hanlon8-Jan-13 22:27 
AnswerRe: Looking for a specific regex Pin
savbace8-Jan-13 23:49
savbace8-Jan-13 23:49 
AnswerRe: Looking for a specific regex Pin
lmoelleb9-Jan-13 0:12
lmoelleb9-Jan-13 0:12 
GeneralRe: Looking for a specific regex Pin
Dennis Bork9-Jan-13 3:26
Dennis Bork9-Jan-13 3:26 
AnswerRe: Looking for a specific regex Pin
thewazz9-Jan-13 3:38
professionalthewazz9-Jan-13 3:38 
AnswerRe: Looking for a specific regex Pin
PIEBALDconsult9-Jan-13 3:42
mvePIEBALDconsult9-Jan-13 3:42 
QuestionOrder execution sequence Pin
vanikanc8-Jan-13 10:32
vanikanc8-Jan-13 10:32 
AnswerRe: Order execution sequence Pin
YENSIX8-Jan-13 11:17
YENSIX8-Jan-13 11:17 
C#

Forgive me, but I'm making a few assumptions here in regards to your question...

SQL
CREATE PROCEDURE dbo.Foo
  @StateCode AS CHAR(2),
  @OutVariable1 AS INT OUTPUT,
  @OutVariable2 AS INT OUTPUT
AS
BEGIN
  SET @OutVariable1 = 100
  SET @OutVariable2 = 150

  SELECT * FROM dbo.Persons WHERE State = @StateCode
END


C#
string stateCode = "AL";
int outValue1 = 0;
int outValue2 = 0;

using (SqlConnection = new SqlConnection(connectionString)) {
    using (SqlCommand cmd = new SqlCommand("dbo.Foo") ) {
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Paramaters.Add("@StateCode", SqlDbType.Char, 2) = stateCode;
        SqlParameter outValue1Param = cmd.Parameters.Add("@OutVariable1", SqlDbType.Int);
        SqlParameter outValue2Param = cmd.Parameters.Add("@OutVariable2", SqlDbType.Int);

        // Get Result Set
        using (DataReader dr = cmd.ExecuteReader()) {
            while ( dr.Read() ) {
                // Read datareader value
            }
        }

        // Get output values
        outValue1 = (int) outValue1Param.Value;
        outValue2 = (int) outValue2Param.Value;
    }
}


I hope that helps.
GeneralRe: Order execution sequence Pin
vanikanc8-Jan-13 14:36
vanikanc8-Jan-13 14:36 
GeneralRe: Order execution sequence Pin
vanikanc9-Jan-13 5:24
vanikanc9-Jan-13 5:24 
GeneralRe: Order execution sequence Pin
Pete O'Hanlon9-Jan-13 5:28
mvePete O'Hanlon9-Jan-13 5:28 
GeneralRe: Order execution sequence Pin
vanikanc9-Jan-13 9:41
vanikanc9-Jan-13 9:41 
GeneralRe: Order execution sequence Pin
YENSIX10-Jan-13 10:56
YENSIX10-Jan-13 10:56 
GeneralRe: Order execution sequence Pin
vanikanc14-Jan-13 9:45
vanikanc14-Jan-13 9:45 
QuestionCalling Console project Pin
PozzaVecia8-Jan-13 9:08
PozzaVecia8-Jan-13 9:08 
AnswerRe: Calling Console project Pin
PIEBALDconsult8-Jan-13 9:17
mvePIEBALDconsult8-Jan-13 9:17 
GeneralRe: Calling Console project Pin
SledgeHammer018-Jan-13 9:31
SledgeHammer018-Jan-13 9:31 
GeneralRe: Calling Console project Pin
PIEBALDconsult8-Jan-13 11:05
mvePIEBALDconsult8-Jan-13 11:05 
AnswerRe: Calling Console project Pin
PozzaVecia8-Jan-13 9:23
PozzaVecia8-Jan-13 9:23 
GeneralRe: Calling Console project Pin
SledgeHammer018-Jan-13 9:31
SledgeHammer018-Jan-13 9:31 
GeneralRe: Calling Console project Pin
PIEBALDconsult17-Jan-13 12:45
mvePIEBALDconsult17-Jan-13 12:45 
GeneralRe: Calling Console project Pin
Dave Kreskowiak8-Jan-13 9:44
mveDave Kreskowiak8-Jan-13 9:44 
GeneralRe: Calling Console project Pin
PozzaVecia8-Jan-13 10:41
PozzaVecia8-Jan-13 10:41 
GeneralRe: Calling Console project Pin
Pete O'Hanlon8-Jan-13 11:28
mvePete O'Hanlon8-Jan-13 11:28 
GeneralRe: Calling Console project Pin
Dave Kreskowiak8-Jan-13 12:41
mveDave Kreskowiak8-Jan-13 12:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.