--- DatabaseLayer.cpp 2006/09/01 03:09:15 25 +++ DatabaseLayer.cpp 2006/09/01 03:24:34 26 @@ -218,6 +218,8 @@ { vector buffer; + //here are the wanted equipments found through 3 seperate queries - I could also + //find them all in one query where I joined the 3 selects via a UNION CString SQL; if (available == true) { SQL = "SELECT DISTINCT Udstyr.stregkode,Udstyr.Navn,Udstyr.Beskrivelse,Udstyr.Placering,Status.Beskrivelse \ @@ -240,13 +242,13 @@ INNER JOIN Status ON Udstyr.status = Status.StatusID \r\n\ INNER JOIN Resevation ON Udstyr.Stregkode = Resevation.stregkode \r\n\ INNER JOIN Person ON Resevation.PersonID = Person.PersonID\r\n\ - WHERE Udstyr.Status = 2 "; + WHERE ( Udstyr.Status = 2 OR Person.Initialer = '" + inits + "') "; if (barcode != "") SQL += " AND Udstyr.stregkode = '" + barcode + "' "; if (name != "") SQL += " AND Udstyr.Navn LIKE '%" + name + "%' "; - if (inits != "") - SQL += " AND Person.Initialer = '" + inits + "' "; + //if (inits != "") + // SQL += " AND Person.Initialer = '" + inits + "' "; CRecordset rs(&db); rs.Open(AFX_DB_USE_DEFAULT_TYPE, SQL); @@ -276,6 +278,9 @@ rs.Close(); } + // now I have the equipment rows the user asked for, now I need some more checkout and + // reservation data for each piece of equipment + for (int i=0; i