File Geodatabase row.SetValue error

3252
3
04-04-2013 02:22 PM
PrzemyslawTyrtania
New Contributor
I have a Text field with Length of 1073741822 (pretty long) I'm able to set value with no error but getting value throws following error: The value type is incompatible with the field type. Code is simple:

string text = row.GetString("fieldName");

if i query row.FieldInformation i get correct results: Field type is String and Length is 1073741822

We're using v1.2 but i dont see anything in 1.3 that would fix this.

We found a solution to this, and it seems to be a bug in API:

This works:

foreach (Row dRow in RowCollection)
                {
                    dRow.GetString(fieldname);
                }

This doesn???t work:

Row row = null;
foreach (Row dRow in RowCollection)
                {
                    Row = dRow;
                    break;
                }
row.GetString(fieldname);

This doesn't work
Row row = RowCollection.First();
row.GetString(fieldname);
0 Kudos
3 Replies
VinceAngelo
Esri Esteemed Contributor
In the first example, the Row is in scope.  In the second it is not.  The third usage
is rather odd; I'm not suprised it doesn't work -- cursors have a lifetime, after all.

Have you tried extracting the data while the row was in scope?  That is the expected
use pattern.

A gigabyte text field, while legal, isn't likely to be the most efficient way to
manage data.

BTW: At five months since release, you really ought to be using the v1.3 release.

- V
0 Kudos
PrzemyslawTyrtania
New Contributor
In the first example, the Row is in scope.  In the second it is not.  The third usage
is rather odd; I'm not suprised it doesn't work -- cursors have a lifetime, after all.

Have you tried extracting the data while the row was in scope?  That is the expected
use pattern.

A gigabyte text field, while legal, isn't likely to be the most efficient way to
manage data.

BTW: At five months since release, you really ought to be using the v1.3 release.

- V


Yea i should have cleaned up that code a bit before posting, it was a copy/paste from email, either way it doesn't work, the idea of code below is to take the first row from collection so that i can return it and other function will modify it later, or maybe i want to modify it in the same method, either way it will error.

Row row = null;
foreach (Row dRow in RowCollection)
{
   row = dRow;
   break;
}
row.GetString(fieldname);

i will update to v1.3 but since this is really a cursor that you're impleneting i will probably get same results, howerver you guys should have really named this a 'cursor' and why include all of these collection methods if they do not work ie .First() since everything must be done in scope none of them will work.

Row row = RowCollection.First();
row.GetString(fieldname);
0 Kudos
VinceAngelo
Esri Esteemed Contributor
You haven't provided enough code to see your Search parameters; if you specified
a true on recycling, then it's not surprising that the Rows in the enumeration are
not durable.

Note: If you use the "Code" block operator ("#" in th editor UI), then the Forums
will preserve your indent scheme.

- V
0 Kudos