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.

C# DataRow Auslesen eines Spalteninhaltes

Empfohlene Antworten

Veröffentlicht

Ich habe eine DataTable mit einer Ergebniszeile und möchte den Wert einer bestimmten Spalte "status" auslesen.

Folgender Code:

            

foreach (DataRow dr in d.Rows)

            {

                Console.WriteLine(dr["status"].ToString());

            }

Es kommt eine leere Zeile heraus. Dabei möchte ich doch den Inhalt der Spalte status Wenn ich den Code wie folgt ändere, kommt die ganze DataRow
            

foreach (DataRow dr in d.Rows)

            {

                Console.WriteLine(dr[0].ToString());

            }

Irgendwie scheint die Eingabe des Spaltennamens nicht zu funktionieren?!?!

Wer kann mir helfen?

Probier doch mal, anstatt nur mit den Reihen zu arbeiten, mit der ganzen Tabelle zu arbeiten. Ich kenne DataTable nicht und kann daher nur vermuten, aber ich schätze mal, man kann mit 2 Indezes sowohl die Reihe als auch die Spalte angeben. Und zwar nicht über einen string, sondern über 2 Integer. Bei einem DataGridView zum Beispiel sieht das in etwa so aus:

dataGridView1[0, 1];

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.