private void SelectColumn() { const string connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=EmployeeInformation.accdb"; var conn = new OleDbConnection(connstr); conn.Open(); const string SQL = "SELECT * FROM Employees"; var cmd = new OleDbCommand(SQL, conn); OleDbDataReader reader = cmd.ExecuteReader(); if (reader != null) { for (int i = 0; i < reader.FieldCount; i++) { cboSearchType.Items.Add(reader.GetName(i)); } } }
for (int i = 0; i < reader.FieldCount; i++) { cboSearchType.Items.Add(reader.GetName(i)); }
for (int i = 0; i < reader.FieldCount; i++) { if(i!=0)//specify which row you want hide eg:i=0 { cboSearchType.Items.Add(reader.GetName(i)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)