if corrct this code it will come of the list in the datagridview in VB from access
this my code:
Private Sub ComboBoxadm_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxadm.SelectedIndexChanged
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"
If conn.State = ConnectionState.Open Then conn.Close()
conn.Open()
Dim sql As String = "Select [Stud Admin] As [User Name], TimeIn, TimeOut From tbl_studentadm Where ProjectNo ='" & ComboBoxadm.Items(ComboBoxadm.SelectedIndex) & "'"
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql, conn)
sqlCom.Connection = conn
Dim sqlReader As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader()
If sqlReader.HasRows Then
sqlReader.Read()
DataGridView1.Text = (sqlReader.Item("[User Name]").ToString)
DataGridView1.Text = (sqlReader.Item("TimeIn").ToString)
DataGridView1.Text = (sqlReader.Item("TimeOut").ToString)
End If
sqlReader.Close()
sqlCom.Dispose()
conn.Close()
End Sub
End Class