HELP TO POPULATE LIST VIEW WITH DATA FROM MYSQL

Please may you help me VB.NET What i want to do,Is just to display data from mysql into listview named lvList.But the problem I'm getting is that when i use the code bellow it display only Fullname horizontally next record in the next collumn without sex filed. But the things i want is to be able to display Fullname and sex one record after another i.e next record to be in the next row not collumn with Fullname and Sex,Sex in the next collumn Here in the code I'm Using; Imports System Imports System.Data.Odbc Imports System.Data Imports System.Data.OleDb Public Class FrmModify Private pConn As OdbcConnection Private pCommand As OdbcCommand Dim ds1, ds2, ds3 As New DataSet Public gConnstr As String Private pDataAdapter As OdbcDataAdapter Private ans As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gConnstr = "DRIVER={" + "MySQL ODBC 3.51 Driver" _ + "};SERVER=" + "localhost" _ + ";UID=" + "root" _ + ";PWD=" + "admin" _ + ";DATABASE=" + "pccb_db" _ + ";Max Pool Size=50" _ + ";Min Pool Size=5" _ + "Pooling=True" _ + ";OPTION=3" pConn = New OdbcConnection() pConn.ConnectionString = Me.gConnstr pCommand = New OdbcCommand() pDataAdapter = New OdbcDataAdapter() Dim mDataTable As New DataTable() pCommand.Connection = pConn pCommand.CommandText = "SELECT FName, Sex FROM Staff_tbl ORDER BY FName ASC" pDataAdapter.SelectCommand = pCommand pDataAdapter.Fill(mDataTable) Dim lvwItem As ListViewItem lvList.Clear() For i As Integer = 0 To mDataTable.Rows.Count - 1 lvwItem = New ListViewItem lvwItem.Text = mDataTable.Rows(i).Item("FName").ToString lvwItem.SubItems.Add(mDataTable.Rows(i).Item("Sex").ToString) lvList.Items.Add(lvwItem) Next i End Sub

Add new comment