Revision: 28078
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 30, 2010 11:08 by vedgiee
Initial Code
######### SQL ######################################### CREATE PROCEDURE dbo.getTwoValues ( @param1 int ) AS SELECT returnval1, returnval2 FROM tblWhatever WHERE param1 = @param1 ########## C# ######################################### string connString = ConnectionManager.ConnectionString["ConnString"].ToString(); using(SqlConnection conn = new SqlConnection(connString)) { SqlCommand getTwoValues = new SqlCommand("[getTwoValues]", conn); getTwoValues.CommandType = ...StoredProcedure; getTwoValues.Parameters.AddWithValue("@param1", 1); conn.Open(); SqlDataReader reader = getTwoValues.ExecuteReader(); // Repeat for all returned rows while(reader.Read()) { string firstValue = reader.GetString(reader.GetOrdinal("returnval1")); int secondValue = reader.GetInt32(readder.GetOrdinal("returnval2")); // Do stuff with values } }
Initial URL
Initial Description
Initial Title
Return Multiple Values Stored Procedure
Initial Tags
sql
Initial Language
SQL