Where Bedingung für die Abfrage zusammenstellen
[Visual Basic]
Private Sub Get_SQLWhere()
[Visual Basic] Private Sub Get_SQLWhere()
Me.auswertungen.ParamCollection.Clear()
Dim s As String
Dim i As Integer
Me.SQLWhere = ""
If Me.cbparam1.Text <> "" And Me.cbop1.Text <> "" And Me.cbvalue1.Text <> "" Then
Me.auswertungen.ParamCollection.Add(cbparam1.Text & " " & cbop1.Text & " " & cbvalue1.Text)
s = cbparam1.Text & " " & cbop1.Text & " " & cbvalue1.Text
SQLWhere = SQLWhere + get_where(1)
End If
If Me.cbandor1.Text <> "" And Me.cbparam2.Text <> "" And Me.cbop2.Text <> "" And Me.cbvalue2.Text <> "" Then
If Me.cbandor1.Text = "und" Then SQLWhere = SQLWhere + " and " + get_where(2)
If Me.cbandor1.Text = "oder" Then SQLWhere = SQLWhere + " or " + get_where(2)
Me.auswertungen.ParamCollection.Add(cbandor1.Text + " " + cbparam2.Text & " " & cbop2.Text & " " & cbvalue2.Text)
s = s & "' & Chr(10) & Chr(13) & '" & cbandor1.Text & " " & cbparam2.Text & " " & cbop2.Text & " " & cbvalue2.Text
End If
If Me.cbandor2.Text <> "" And Me.cbparam3.Text <> "" And Me.cbop3.Text <> "" And Me.cbvalue3.Text <> "" Then
If Me.cbandor2.Text = "und" Then SQLWhere = SQLWhere + " and " + get_where(3)
If Me.cbandor2.Text = "oder" Then SQLWhere = SQLWhere + " or " + get_where(3)
Me.auswertungen.ParamCollection.Add(cbandor2.Text + " " + cbparam3.Text & " " & cbop3.Text & " " & cbvalue3.Text)
s = s + " " + cbandor2.Text + " " + cbparam3.Text & " " & cbop3.Text & " " & cbvalue3.Text
End If
If Me.cbandor3.Text <> "" And Me.cbparam4.Text <> "" And Me.cbop4.Text <> "" And Me.cbvalue4.Text <> "" Then
If Me.cbandor3.Text = "und" Then SQLWhere = SQLWhere + " and " + get_where(4)
If Me.cbandor3.Text = "oder" Then SQLWhere = SQLWhere + " or " + get_where(4)
Me.auswertungen.ParamCollection.Add(cbandor3.Text + " " + cbparam4.Text & " " & cbop4.Text & " " & cbvalue4.Text)
s = s + " " + cbandor3.Text + " " + cbparam4.Text & " " & cbop4.Text & " " & cbvalue4.Text
End If
If Me.cbandor4.Text <> "" And Me.cbparam5.Text <> "" And Me.cbop5.Text <> "" And Me.cbvalue5.Text <> "" Then
If Me.cbandor4.Text = "und" Then SQLWhere = SQLWhere + " and " + get_where(5)
If Me.cbandor4.Text = "oder" Then SQLWhere = SQLWhere + " or " + get_where(5)
Me.auswertungen.ParamCollection.Add(cbandor4.Text + " " + cbparam5.Text & " " & cbop5.Text & " " & cbvalue5.Text)
s = s + " " + cbandor4.Text + " " + cbparam5.Text & " " & cbop5.Text & " " & cbvalue5.Text
End If
If Me.cbandor5.Text <> "" And Me.cbparam6.Text <> "" And Me.cbop6.Text <> "" And Me.cbvalue6.Text <> "" Then
If Me.cbandor5.Text = "und" Then SQLWhere = SQLWhere + " and " + get_where(6)
If Me.cbandor5.Text = "oder" Then SQLWhere = SQLWhere + " or " + get_where(6)
Me.auswertungen.ParamCollection.Add(cbandor5.Text + " " + cbparam6.Text & " " & cbop6.Text & " " & cbvalue6.Text)
s = s + " " + cbandor5.Text + " " + cbparam6.Text & " " & cbop6.Text & " " & cbvalue6.Text
End If
If Me.cbandor6.Text <> "" And Me.cbparam7.Text <> "" And Me.cbop7.Text <> "" And Me.cbvalue7.Text <> "" Then
If Me.cbandor6.Text = "und" Then SQLWhere = SQLWhere + " and " + get_where(7)
If Me.cbandor6.Text = "oder" Then SQLWhere = SQLWhere + " or " + get_where(7)
Me.auswertungen.ParamCollection.Add(cbandor6.Text + " " + cbparam7.Text & " " & cbop7.Text & " " & cbvalue7.Text)
s = s + " " + cbandor6.Text + " " + cbparam7.Text & " " & cbop7.Text & " " & cbvalue7.Text
End If
Me.auswertungen.FullParam = s
End Sub
Plattformen: Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition