Question

I have just learned about this way of populating th datagridview. Usually I just bind it as the access file is connected to the app.

Dim query As String = "SELECT * FROM tblCpu"
            Using cmd As New OleDbCommand(query, con)
                Dim dr As OleDbDataReader = cmd.ExecuteReader
                Dim dt As New DataTable
                dt.Load(dr)
                dgvComponents.DataSource = dt
            End Using

Now this code shows all the rows/colums of the table.. including ID.. in which I don't want the user to see..
Is there a way to remove, or make the ID column invisible?

Était-ce utile?

La solution

Change your SQL statement to include only fields you want to see:

Dim query As String = "SELECT City, Address, Country, Region FROM Customers"
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top