/// <summary> /// LoadNewRow() /// </summary> /// <param name="row"></param> public void LoadNewRow(object[] row) { DataRow newRow = DataTblObj.NewRow(); newRow["Isn"] = 0; for (int i = 0; i < DataTblObj.Columns.Count; i++) { newRow[i] = row[i]; } DataTblObj.Rows.InsertAt(newRow, CurrRow); }
/// <summary> /// Add row to DataTable object. /// </summary> /// <param name="parser">current XML parser.</param> private void AddRow(XmlParser parser) { DataRow row = DataTblObj.NewRow(); foreach (DataColumn column in DataTblObj.Columns) { //read column tag parser.setCurrIndex2EndOfTag(); //read index till end if column tag int endContext = parser.getXMLdata().IndexOf(XMLConstants.END_TAG, parser.getCurrIndex()); if (endContext != -1) { // read column value String valueStr = parser.getXMLsubstring(endContext); if (column.DataType == typeof(Byte[])) { //convert the base64 string to byte[] Byte[] bstr = Base64.decodeToByte(valueStr); row[column.ColumnName] = bstr; } else { if (valueStr.Equals("_DBNull_")) { row[column.ColumnName] = Convert.DBNull; } else { row[column.ColumnName] = XmlParser.unescape(valueStr); } } //TODO : need to check and handle : how to insert binary data in a column parser.setCurrIndex2EndOfTag(); } } DataTblObj.Rows.Add(row); }