# Convert nvarchar t

**URL:** <https://www.epiusers.help/t/convert-nvarchar-t/104519>\
**Category:** Epicor ERP 10\
**Tags:** e10\
**Created:** [June 27, 2023, 9:10pm UTC](https://www.epiusers.help/t/convert-nvarchar-t/104519 "2023-06-27T21:10:45Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![klincecum](https://www.epiusers.help/user_avatar/www.epiusers.help/klincecum/32/100137_2.png) [@klincecum](https://www.epiusers.help/u/klincecum)\
**Post date:** [June 27, 2023, 10:14pm UTC](https://www.epiusers.help/t/convert-nvarchar-t/104519/13 "2023-06-27T22:14:24Z")

</div>

I may have spoken too soon.

I just realized we had a similar discussion before:

> [@Index was outside the bounds of the array in Data Directive Custom Code on UD100](https://www.epiusers.help/t/index-was-outside-the-bounds-of-the-array-in-data-directive-custom-code-on-ud100/100160/12):
>
> int lastRecord\_ID = 0; Ice.Tables.UD100 lastRecord = null; try { lastRecord = (from ud100Rows in Db.UD100 orderby ud100Rows.Key1 descending select ud100Rows).First(); } catch {}; if(lastRecord != null) lastRecord\_ID = Convert.ToInt32(lastRecord.Key1); foreach(var record in ds.UD100.Where(rec =\> rec.RowMod == "A")) { lastRecord\_ID++; int leadingZeros = 10; string fmt = new String('0', leadingZeros) + "#"; record.Key1 = last…

---

_[View the full topic](https://www.epiusers.help/t/convert-nvarchar-t/104519)._
