Hallo, leutz ich bin grad am herumbasteln mit ner datenbank und hab grad kein plan wo das Problem liegt.
Und zwar versuch ich mit folgenden Code eine Datenbank in eine Listview mit Spalten Einzutragen.
So jetzt hab ich folgendes Problem und zwar Spuckt der Mir folgenden fehler an der stelle .FillDatatable aus
Der connection String wird vorher so gesetzt:
Wo liegt hier der Hund Begraben? kann mir das wer sagen?
Ich hoffe, dass ihr mir hierbei helfen könnt danke
Und zwar versuch ich mit folgenden Code eine Datenbank in eine Listview mit Spalten Einzutragen.
VB.NET-Quellcode
- MySQLReadConn.Open()
- Dim sqlQuery As String = "SELECT * FROM " + Mysqlusertable
- MsgBox(sqlQuery)
- Dim sqlAdapter As New MySqlDataAdapter
- Dim sqlCommand As New MySqlCommand
- Dim datatable As New DataTable
- Dim i As Integer
- With sqlCommand
- .CommandText = sqlQuery
- .Connection = MySQLReadConn
- End With
- With sqlAdapter
- Try
- .SelectCommand = sqlCommand
- .Fill(datatable)
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- End With
- For i = 0 To datatable.Rows.Count - 1
- With listview
- .Items.Add(datatable.Rows(i)("id"))
- With .Items(.Items.Count - 1).SubItems
- .Add(datatable.Rows(i)("name"))
- .Add(datatable.Rows(i)("pass"))
- End With
- End With
- Next
- End Sub
So jetzt hab ich folgendes Problem und zwar Spuckt der Mir folgenden fehler an der stelle .FillDatatable aus
Der connection String wird vorher so gesetzt:
Wo liegt hier der Hund Begraben? kann mir das wer sagen?
Ich hoffe, dass ihr mir hierbei helfen könnt danke