public void LoadExcelFields(string strConn) { try { parameters.currSheet = cboSelectWorksheet.Text; //sheetName = cboSelectWorksheet.Text; fileName = txtFileName.Text; if (parameters.currSheet != "") { OleDbConnection newConn = new OleDbConnection(strConn); newConn.Open(); OleDbCommand cmd = newConn.CreateCommand(); cmd.CommandText = "SELECT * FROM [" + sheetName + "]"; dtReader = cmd.ExecuteReader(); if (dtReader.Read()) { for (int x = 0; x < dtReader.FieldCount; x++) { lstboxExcelFields.Items.Add(dtReader.GetName(x)); } } dtReader.Close(); cmd.Dispose(); newConn.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)