Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

In den SQL-STRING eine Klammer einfügen !

Empfohlene Antworten

Veröffentlicht

Hallo !

Ich habe hier Probleme mit meinem SQL-String und zwar müssen hier die Blöcke in klammern stehen, wie kann ich das am besten lösen:

Where CustomerCountry = 'Germany' OR CustomerCountry = 'The Netherlands' AND Industry_Type = 'Chemistry' OR Industry_Type = 'Food and beverage' AND Application_Type = 'Batching' OR Application_Type = 'Weighbridge'

so sollte es aussehen:

Where (CustomerCountry = 'Germany' OR CustomerCountry = 'The Netherlands') AND (Industry_Type = 'Chemistry' OR Industry_Type = 'Food and beverage') AND (Application_Type = 'Batching' OR Application_Type = 'Weighbridge')

IF Request.Form ("country") <> "" THEN

IF SQL2 <> "" THEN SQL2 = SQL2 & " AND "

For i = 1 to Request.Form ("country").count

IF SQL2a <> "" THEN SQL2a = SQL2a & " OR "

SQL2a = SQL2a & " ( CustomerCountry = '" & Request.Form ("country")(i) & ") '"

next

SQL2 = SQL2 & SQL2a

SQL2a = ""

END IF

also den Code den Du jetzt hast der Funktioniert doch für die ersten Zeilen also für

(CustomerCountry = 'Germany' OR CustomerCountry = 'The Netherlands') AND

wiesieht den den das Ausgangsformular aus??

und was sol, wie imn den SQLText??

Bei mir sieht die Klammerfolgen dann so aus !

Where (CustomerCountry = 'Germany') (OR CustomerCountry = 'The Netherlands') AND (Industry_Type = 'Chemistry') OR Industry_Type = 'Food and beverage') AND (Application_Type = 'Batching') (OR Application_Type = 'Weighbridge')

Leider gibt er mir dann auch Datensätze aus die nur mit Germany "oder" mit Chemistry "oder" mit Batching zu tun haben.

dann versuch doch mal diese Reihenfolge:

IF Request.Form ("country") <> "" THEN

IF SQL2 <> "" THEN SQL2 = SQL2 & ") AND ("

For i = 1 to Request.Form ("country").count

IF SQL2a <> "" THEN SQL2a = SQL2a & " OR "

IF SQL2a = "" THEN SQL2a = "("

SQL2a = SQL2a & " CustomerCountry = '" & Request.Form ("country")(i) & "'"

next i

SQL2 = SQL2 & SQL2a

SQL2a = ""

END IF

Aber wie gesagt. hilfreich wäre es wenn Du mal den ganzen Code der Seite postest, dann kann ich das hier bei mir kurz testen und schon ist es ok. so kann ich immer nur raten was gemeint ist

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.