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.

Erstellung eines lookup-Fields

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich habe eine kurze Frage, evtl. kann mir jmd. weiterhelfen. Ich habe ein Feld, wenn in dieses Feld ein Wert eingetragen wird, dann soll in der Datenbank nach dem Account gesucht werden und das Objekt zurück gegeben werden. Ich dachte mir nun, dass ich das einfach über LINQ lösen kann, aber dies scheint nicht zu funktionieren. C# gibt mir das Folgende zurück. Gehe ich hier völlig falsch ran? Kann mir jmd. Hinweise geben? Bin über jeden Hilfshinweis froh, links, tipps, alles super. Nonplus ultra wäre noch wenn ich mir n Formular öffnen kann, in welchem

ich meine Objekte anzeige, sofern mehr eine Menge > 1 herauskommt, aber das

bekomme ich dann noch raus.

Cannot implicitly convert type 'BasicData.Accounts.ACCT' to 'DataEntry.Receipts.ACCT'


            if (aCCT_IDTextBox.Text != "")

            {

                var selectedAccount = from accounts in ad.ACCTs

                                      where accounts.Main_Account.Contains(aCCT_IDTextBox.Text)

                                      select accounts;


                if (selectedAccount.Count() == 0)

                {

                    MessageBox.Show("Could not find account! Is it a sub account?");                    

                }

                else if (selectedAccount.Count() == 1)

                {

                    ACCT lookedupAccount = selectedAccount.First();

                }

                else

                {

                    MessageBox.Show("Found too many accounts. Please specify your search criteria!");                

                }

            }

Viele Grüße

Mathias

contains ist eine generisch implementierte Methode, d.h. du versuchst gerade in einer collection vom typ x nach einem object des typs y zu suchen, das geht nur, wenn y z.b. von x erbt und somit y z.b. eine kovariante entität von x ist.

weiterhin solltest du wissen, das nur die referenzen verglichen werden, für andere vergleiche muss man equals überschreiben.

Benutz eine ID zum Vergleich, damit solltest du doch weiterkommen.

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.