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.

lstfield.rowsource = Oracle Recordset???

Empfohlene Antworten

Veröffentlicht

Hallo Zusammen,

nun habe ich das nächste Problem:

Ich mache eine Connection zu einer Oracle DB auf (con)

Ich habe einen ADODB.Recordset (rs)

und eine sSQL Variable (Typ String)

Ich hole mir Daten aus Oracle:


sSQL = "select * from table"

rs.open sSQL, con, adOpenForwardOnly

Jetzt möchte ich das was im Recordset steht einem Listenfeld in der GUI

zuweisen!! Aber wie???

lstfield.rowsource = rs.???????

Wie mache ich das? Ich habe alles mögliche schon probiert..

Danke und Gruß

Druid :cool:

    Dim i As Integer

    Dim j As Integer


    Dim itmx As ListItem


    lstvDaten.ColumnHeaders.Clear

    lstvDaten.ListItems.Clear


    lstvDaten.ColumnHeaders.Add , , "ID", 0


    If cboSpalten.ListIndex > -1 Then


        SpaltenName = cboSpalten.List(cboSpalten.ListIndex)


        Set Conn = New ADODB.Connection                      ' Conn wird als neue ADO Datenbank Verbindung anerkannt

        With Conn


            .Provider = "Microsoft Jet 4.0 OLE DB Provider"     ' Datenbankformat: Access 2000


            .ConnectionString = "Data Source=" & strAppPath & DBName & "" ' Datenquelle

            .Properties("Jet OLEDB:Database Password") = DBpw

            .Open                                               ' Verbindung öffnen


        End With


        Set RecSet = New Recordset

        With RecSet


            .ActiveConnection = Conn

            .CursorLocation = adUseClient

            .Source = "SELECT * FROM " & TabellenName & " WHERE " & SpaltenName & " <> """" AND " & SpaltenName & " IS NOT NULL"

            .Open


        End With


        For i = 1 To RecSet.Fields.Count - 1


            lstvDaten.ColumnHeaders.Add , , RecSet.Fields(i).Name, 1500


        Next i


        While Not RecSet.EOF


            Set itmx = lstvDaten.ListItems.Add


            For j = 1 To RecSet.Fields.Count - 1


                If Not IsNull(RecSet.Fields(j)) Then


                    itmx.SubItems(j) = RecSet.Fields(j)


                Else


                    itmx.SubItems(j) = ""


                End If


            Next j


            RecSet.MoveNext


        Wend


        RecSet.Close

        Set RecSet = Nothing

        Conn.Close

        Set Conn = Nothing


    Else


        MsgBox Err.Description, vbCritical + vbOKOnly


    End If

Ist mit einem Listview gemacht und mit einer Access DB.

Vielleicht hilft dir das. :WD

Hi,

schonmal ne gute Idee.. mit Subitems hab ich mir auch überlegt.

Wenn ich aber Dim lsitx as ListItem machen will lässt er das nicht zu

weil es dass nicht gibt.

Ich hab auch keine Möglichkeit Subitems zu definieren.

Da fehlt mir wahrscheinlich ein Verweis oder?

Gruß

Druid :cool:

Du mußt nur die "Microsoft Windows Common Control 6.0" zu den Komponenten hinzufügen. Dann steht dir das Listview

Zuverfügung.

Als zusätzlicher Verweis hab ich noch die "Microsoft ActiveX Data Objects 2.8 Library drin, mehr nischt. :WD

mmmmhhhh..

"Microsoft Windows Common Control 6.0" gibts bei mir nicht.

Gibt es denn keine einfachere Möglichkeit?

Das man das wie mit nem normalen Listenfeld macht?


sSQL = "select * from table"

lstübersicht.rowsource = sSQL

Denn deine Lösung ist ein bisschen umständlich :rolleyes:

Druid :cool:

naja bis das mit dem listview bei mir richtig gefunzt hat, hats auch 1-2 tage gedauert. Handbücher durchackern und Beispiel-Codes verstehen versuchen. :)

Was für n Betriebssystem hast du drauf?

Hab Win2000 SP4. Sonst ist die MWCC 6.0 nicht da nur die 5.0 oder niedriger. Meines wissens genügt es wenn man die Version 4.0 hat.

ich hab windows xp ohne service packs. Das ganze in Verbindung mit Access 2000...

Jetzt mal ne blöde Frage: Wo wähle ich Komponenten aus? In den Verweisen hab ich weder Einträge für MCC 6,5 oder 4...

Gruß

Druid :cool:

ähm.. Du hast doch deine Leiste, wo deine Labels, picturebox, image commandbutton, combobox.. usw herbekommst. dort einfach rechtsklicken und auf komponenten gehen. Unter Steuerelementen kann du es dann auswählen.

Hey, bis vor ca 4 Monaten wußte ich auch nix davon! :WD

das schlimme ist ja: ich wusste es schon mal und hab es schon mal gemacht.

Nur das war vor 1 1/2 Jahren während der Ausbildung. Und jetzt fang ich in

der Arbeit wieder das Programmieren an und merke wie schnell doch ein

Mensch vergessen kann... :eek:

Aber mal zum Thema. Die MCC find ich da auch nicht. Ich habe aber was

anderes gefunden: "Microsoft ListView Control 6.0" Da gibt es ListItems

und SubItems. Meinst du damit könnte es auch gehen?

Oder besser: Ich probiers einfach aus ;-)

Gruß

Druid :cool:

Ich habe aber was

anderes gefunden: "Microsoft ListView Control 6.0" Da gibt es ListItems

und SubItems.

Das hört sich doch gut an! :WD

Viel Erfolg.

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.