[Visual Basic] Private Function get_where( _
ByVal nr As Integer _
) As String
[Visual Basic] Private Function get_where(ByVal nr As Integer) As String
Dim param As New ComboBox
Dim op As New ComboBox
Dim val As New ComboBox
l.Clear()
Dim feld As String
Dim dr As DataRow
feld = "cbparam" + Trim(Str(nr))
Me.GetControl(Me, feld, l)
param = l.Item(0)
l.Clear()
feld = "cbop" + Trim(Str(nr))
Me.GetControl(Me, feld, l)
op = l.Item(0)
l.Clear()
feld = "cbvalue" + Trim(Str(nr))
Me.GetControl(Me, feld, l)
val = l.Item(0)
dr = Me.Findrow(param.Text)
Dim wertvalue As String = ""
Dim wertdbfeld As String = ""
Dim wertop As String = op.Text
wertop = op.Text
Dim paramtyp As String = ""
Dim paramsplit() As String = dr.Item("Paramtype").ToString.Split(";")
Dim dbfeldsplit() As String = dr.Item("dbfeldname").ToString.Split(";")
If dbfeldsplit.Length > 1 And val.SelectedIndex > -1 Then
wertvalue = val.SelectedValue
wertdbfeld = dbfeldsplit(0)
paramtyp = paramsplit(0)
Else
wertvalue = val.Text
If dbfeldsplit.Length > 1 Then
wertdbfeld = dbfeldsplit(1)
paramtyp = paramsplit(1)
Else
wertdbfeld = dbfeldsplit(0)
paramtyp = paramsplit(0)
End If
End If
Select Case UCase(paramtyp)
Case "VARCHAR", "STRING", "CHAR"
Return wertdbfeld + " " + wertop + " '" + wertvalue + "'"
Case "INTEGER", "INT"
Return wertdbfeld + " " + wertop + " " + wertvalue + ""
Case "DATUM"
Return wertdbfeld + " " + wertop + " '" + wertvalue + " 00:00:00'"
Case "DATUM+1"
Dim d As DateTime = wertvalue
d = DateAdd(DateInterval.Day, 1, d)
wertvalue = d.ToString
Return wertdbfeld + " " + wertop + " '" + wertvalue + " 00:00:00'"
Case "BOOLEAN"
If UCase(wertvalue) = "TRUE" Or UCase(wertvalue) = "JA" Then
Return wertdbfeld + " " + wertop + " 1"
Else
Return wertdbfeld + " " + wertop + " 0"
End If
Case Else
End Select
End Function
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