Exemplo n.º 1
0
        public static List<Batch> getAllBatchList(string batchName)
        {
            OleDbConnection connection = new OleDbConnection(global::ResultManagement.Properties.Settings.Default.ConnectionString);

            String cmdString = @"SELECT batch 
                               FROM Student WHERE 1 ";

            if (batchName != null)
            {
                cmdString += " AND batch = '" + batchName + "'";
            }

            cmdString += " GROUP BY batch";

            OleDbCommand cmd = new OleDbCommand(cmdString, connection);

            List<Batch> batchList = new List<Batch>();

            try
            {
                connection.Open();
                OleDbDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    Batch b = new Batch();
                    b.batchName = (string)reader.GetValue(reader.GetOrdinal("batch"));
                    b.batchID = b.batchName;
                    batchList.Add(b);
                }
            }
            finally
            {
                connection.Close();
            }

            return batchList;
        }
Exemplo n.º 2
0
 public static Batch getAllMapping()
 {
     Batch b = new Batch();
     b.batchID = null;
     b.batchName = "(All)";
     return b;
 }