lstvBatches.Clear(); int iColWidth = (lstvBatches.Width) / 3; lstvBatches.View = View.Details; lstvBatches.Columns.Add("BatchID", iColWidth - 75, HorizontalAlignment.Left); lstvBatches.Columns.Add("Date Loaded", iColWidth - 75, HorizontalAlignment.Left); lstvBatches.Columns.Add("FileName", iColWidth + 150, HorizontalAlignment.Left);lstvBatches.GridLines = true; viewBatches();
//run a query and then read results. string sql = "SELECT * from UUHP_DATA.Auth_IMPLOG order by IMP_PK desc" + Environment.NewLine; OracleDataReader reader = odam.ExecuteReader(sql); if (!reader.HasRows) {
MessageBox.Show("There are no records queried. Please check the sql."); return;
MessageBox.Show("There are no records queried. Please check the sql.");
return;
} int i = 0; while (reader.Read()) {
//Read the basic Member Data. i++; string sPK = reader.GetValue(reader.GetOrdinal("IMP_PK")).ToString(); DateTime dtDate = reader.GetDateTime(reader.GetOrdinal("IMP_DATE")); string sDate = dtDate.ToString("MM/dd/yyyy"); //Gets the date to the correct display format. string sFile = reader.GetValue(reader.GetOrdinal("IMP_FILE")).ToString(); string[] arrayLine = { sPK, sDate, sFile }; ListViewItem sLine = new ListViewItem(arrayLine); lstvBatches.Items.Add(sLine); } lstvBatches.View = View.Details; lstvBatches.GridLines = true; lstvBatches.CheckBoxes = true; this.Refresh();
//Read the basic Member Data.
i++;
string sPK = reader.GetValue(reader.GetOrdinal("IMP_PK")).ToString();
DateTime dtDate = reader.GetDateTime(reader.GetOrdinal("IMP_DATE"));
string sDate = dtDate.ToString("MM/dd/yyyy"); //Gets the date to the correct display format.
string sFile = reader.GetValue(reader.GetOrdinal("IMP_FILE")).ToString();
string[] arrayLine = { sPK, sDate, sFile };
ListViewItem sLine = new ListViewItem(arrayLine);
lstvBatches.Items.Add(sLine);