public IEnumerable <ScanLog> GetAllScansLog() { Scan scan = null; string selectCommand = @" SELECT * FROM ScanLog "; using (SqlCeConnection connect = new SqlCeConnection(Datasource)) { connect.Open(); using (SqlCeCommand command = new SqlCeCommand(selectCommand, connect)) { using (SqlCeDataReader reader = command.ExecuteReader()) { if (reader != null) { while (reader.Read()) { yield return(new ScanLog((int)reader.GetInt32(reader.GetOrdinal("artcode")), (int)reader.GetInt32(reader.GetOrdinal("id_gamma")), (int)reader.GetInt32(reader.GetOrdinal("Qty")), (string)reader.GetString(reader.GetOrdinal("Dt")), (string)reader.GetString(reader.GetOrdinal("Barcode")), (AType)(int)reader.GetSqlInt32(reader.GetOrdinal("ActionType")))); } } } } } }