public static GiftMessage[] FetchByMessageId(int msgId) { var giftsOfMessages = new List<GiftMessage>(); using (SqlConnection conn = Config.DB.Open()) { SqlDataReader reader = (SqlDataReader) SqlHelper.GetDB().ExecuteReader( "FetchGiftsOfMessage", msgId); while (reader.Read()) { var giftMessage = new GiftMessage { id = (int)reader["Id"], GiftId = (int)reader["GiftId"], MessageId = (int) reader["MessageId"] }; giftsOfMessages.Add(giftMessage); } } return giftsOfMessages.ToArray(); }
public static GiftMessage[] FetchByMessageId(int msgId) { var giftsOfMessages = new List<GiftMessage>(); //using (var conn = Config.DB.Open()) { using (var reader = SqlHelper.GetDB().ExecuteReader("FetchGiftsOfMessage", msgId)) { while (reader.Read()) { var giftMessage = new GiftMessage { id = (int) reader["Id"], GiftId = (int) reader["GiftId"], MessageId = (int) reader["MessageId"] }; giftsOfMessages.Add(giftMessage); } reader.Close(); } } return giftsOfMessages.ToArray(); }