示例#1
0
        internal static List <String> LoadProducts(TypeFood typeFood)
        {
            if (dbCon.State == ConnectionState.Closed)
            {
                dbCon.Open();
            }

            string sqGetAllProductsFromType = @"SELECT ProductName, Category FROM Products
                WHERE  (Category = N'" + typeFood.ToString() + "')";

            SqlCeCommand    cmd    = new SqlCeCommand(sqGetAllProductsFromType, dbCon);
            SqlCeDataReader reader = cmd.ExecuteReader();
            List <string>   result = new List <string>();

            while (reader.Read())
            {
                result.Add((string)reader["ProductName"]);
            }

            dbCon.Close();
            return(result);
        }
示例#2
0
 private void WriteDataType(TypeFood type)
 {
     this.type.Text = type.ToString();
 }