Thursday, February 12, 2009

Assignment

SELECT DISTINCT im.name as item, i.name as ingredient
FROM ingredients as i, items as im, madewith as mw,
WHERE i.ingredientid = mw.ingredientid AND im.itemid = mw.itemid AND quantity * 3 > inventory






Monday, February 2, 2009

THEODBS ASSIGNMENT


Private Sub Combo1_Change()
If Combo1 = "Chicken Salad" Then
If DataGrid1 = "Chicken" Or DataGrid1 = "Crouton" Or DataGrid1 = "Lettuce" Then List1.AddItem "" + DataGrid1.Text Else
MsgBox ("Don't need that ingredients!")
End If
End If
If Combo1 = "Fruit Salad" Then
If DataGrid1 = "Apple" Or DataGrid1 = "Cucumber" Or DataGrid1 = "Orange" Or DataGrid1 = "pineapple" Then
List1.AddItem "" + DataGrid1.Text Else
MsgBox ("Don't need that ingredients!")
End If
End If
If Combo1 = "Garden Salad" Then
If DataGrid1 = "Lettuce" Or DataGrid1 = "Apple" Or DataGrid1 = "Secret Dressing" Or DataGrid1 = "Pineapple" Then
List1.AddItem "" + DataGrid1.Text Else
MsgBox ("Don't need that ingredients!")
End If
End If

If Combo1 = "Fruit Plate" Then
If DataGrid1 = "Crouton" Or DataGrid1 = "Lettuce" Or DataGrid1 = "Secret Dressing" Then List1.AddItem "" + DataGrid1.Text Else
MsgBox ("Don't need that ingredients!")
End If
End If
If Combo1 = "Millennium Salad" Then
If DataGrid1 = "Apple" Or DataGrid1 = "Chicken" Or DataGrid1 = "Secret Dressing" Then List1.AddItem "" + DataGrid1.Text Else
MsgBox ("Don't need that ingredients!")
End If
End If
End Sub

Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
If DataEnvironment1.Con1.State = adstateclose Then
DataEnvironment1.Con1.Open
End If
Dim z As String
z = "SELECT ingredients.name,unit, madewith.quantity FROM madewith,ingredients "
rs.Open z, DataEnvironment1.Con1, 1, 3
Set DataGrid1.DataSource = rs
End Sub

Private Sub Command_Click()
If Label2.Caption Like "-1" Then
MsgBox ("Select an item from list")
Exit Sub
End IfI
ndex = Label2.Caption
List1.RemoveItem Index

Private Sub Command3_Click(Index As Integer)
List1.Clear
End Sub