private void GetSQLData(SqlCeDataReader getdata) { tableJournal.Clear(); journalarray.Clear(); while (getdata.Read()) { ItemJournalL insertOneLine = new ItemJournalL(); Object[] array = new Object[9]; insertOneLine.postingDate = Convert.ToDateTime(getdata["PostingDate"]); array[0] = Convert.ToDateTime(getdata["PostingDate"]); insertOneLine.ItemNo = getdata["ItemNo"].ToString(); array[1] = getdata["ItemNo"].ToString(); insertOneLine.location = getdata["Location"].ToString(); array[2] = getdata["Location"].ToString(); insertOneLine.frombin = getdata["FromBin"].ToString(); array[3] = getdata["FromBin"].ToString(); insertOneLine.tobin = getdata["ToBin"].ToString(); array[4] = getdata["ToBin"].ToString(); insertOneLine.quantity = Convert.ToInt32(getdata["Quantity"]); array[5] = Convert.ToInt32(getdata["Quantity"]); insertOneLine.staffdimension = getdata["StaffCode"].ToString(); array[6] = getdata["StaffCode"].ToString(); array[7] = getdata["LineNo"].ToString(); //test3 array[8] = getdata["EmptyTank"].ToString(); //test3 insertOneLine.emptyBin = Convert.ToBoolean(getdata["EmptyTank"]); tableJournal.Rows.Add(array); journalarray.Add(insertOneLine); } BindTOGrid(); }
private void InsertLines() { ItemJournalL insertOneLine = new ItemJournalL(); Object[] array = new Object[8]; insertOneLine.postingDate = DateTime.Now; array[0] = DateTime.Now; insertOneLine.ItemNo = txtItemNo.Text.Trim(); array[1] = txtItemNo.Text.Trim(); insertOneLine.location = "QH1"; array[2] = "QH1"; insertOneLine.frombin = txtFromBin.Text.Trim(); array[3] = txtFromBin.Text.Trim(); insertOneLine.tobin = txtToBin.Text.Trim(); array[4] = txtToBin.Text.Trim(); insertOneLine.quantity = Convert.ToInt32(textBox1.Text.Trim()); array[5] = textBox1.Text.Trim(); insertOneLine.staffdimension = staffdimension; array[6] = staffdimension; if (chkEmpty.Checked) { insertOneLine.emptyBin = true; array[7] = true; } else { insertOneLine.emptyBin = false; array[7] = false; } tableJournal.Rows.Add(array); journalarray.Add(insertOneLine); CompactSQL comsql = new CompactSQL(); comsql.InsertRecord("ItemReclass", array); }