public Collection<Question> GetQuestionOIDBySectionOID(int SOID) { Collection<Question> qList = new Collection<Question>(); using (OdbcConnection connection = new OdbcConnection(connectionString)) { using (OdbcCommand command = new OdbcCommand()) { command.Connection = connection; command.CommandText = "{CALL Question_BySectionOID(?)}"; command.CommandType = CommandType.StoredProcedure; //Set Parameter Value command.Parameters.AddWithValue("@SOID", SOID); //Open connection connection.Open(); //Read using reader using (OdbcDataReader dataReader = command.ExecuteReader()) { QuestionResponse qr = new QuestionResponse(); Question question; while (dataReader.Read()) { question = new Question(); question.QuestionOID = Convert.ToInt32(dataReader["QuestionOID"]); question.CreatedDate = Convert.ToDateTime(dataReader["CreatedDate"]); question.CreatedBy = Convert.ToInt32(dataReader["CreatedBy"]); question.Keyword = Convert.ToString(dataReader["Keyword"]); question.LastModifiedBy = Convert.ToInt32(dataReader["LastModifiedBy"]); question.LastModifiedDate = Convert.ToDateTime(dataReader["LastModifiedDate"]); question.MultipleAllow = Convert.ToInt32(dataReader["MultipleAllow"]); question.OrderNo = Convert.ToInt32(dataReader["OrderNo"]); question.QuestionText = Convert.ToString(dataReader["Question"]); question.RespAction = Convert.ToString(dataReader["RespAction"]); question.SectionOID = Convert.ToInt32(dataReader["SectionOID"]); question.Reverse = Convert.ToInt32(dataReader["Reverse"]); question.QuestionRespList = qr.GetQuestionRespByQOID(question.QuestionOID); qList.Add(question); } } } } return qList; }