Example #1
0
        public Pda GetPda(string pdaName)
        {
            Pda pda = null;

            using (SqlConnection conn = new SqlConnection(connStr))
            {
                conn.Open();
                SqlCommand command = new SqlCommand("SELECT * FROM PdaState WHERE [Pda] = @Pda", conn);
                command.Parameters.AddWithValue("@Pda", pdaName);
                SqlDataReader reader = command.ExecuteReader();
                if (reader.Read())
                {
                    pda = ReadPda(reader);
                }
            }

            return(pda);
        }
Example #2
0
        public Pda[] ListAllPdas()
        {
            List <Pda> pdas = new List <Pda>();

            using (SqlConnection conn = new SqlConnection(connStr))
            {
                conn.Open();
                SqlCommand command = new SqlCommand("SELECT * FROM PdaState ", conn);

                SqlDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    Pda p = ReadPda(reader);
                    pdas.Add(p);
                }
            }

            return(pdas.ToArray());
        }