2

I have a table with blob field and some others as well. I am trying to read blob field and save it to file using IBlobStream, and the thing compiles. The problem comes up in run-time, when calling blobStream.SaveToFile() method, saying:

'object' does not contain a definition for 'SaveToFile'

the following code:

int blobFieldID= table.Fields.FindField("MODEL_NAME");
int nameFieldID= table.Fields.FindField("MODEL");
ICursor cursor = table.Search(null, true);
IRow row = cursor.NextRow();
while (row != null)
{
 IBlobStream blobStream = (IBlobStream)row.get_Value(blobFieldID);
 blobStream.SaveToFile(@"C:\TEMP\" + row.get_Value(nameFieldID) + ".tbx"); //error
 row = cursor.NextRow();
}

When i hover mouse over SaveToFile method it says:

(dynamic expression)
This operation will be resolved at runtime

I can't figure out what's the problem in here

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 16, 2013 at 11:40
5
  • Hi, is this sample running on such as console application? Commented Apr 16, 2013 at 14:04
  • @Darksanta No, It is an action on button click - ESRI.ArcGIS.SystemUI.ICommand.OnClick() Commented Apr 16, 2013 at 14:09
  • hmm, it looks like strange problem. Usually these kind of error happen when using dynamic keyword. Is this able to get other field values correctly? Commented Apr 16, 2013 at 15:37
  • 2
    Ensure that "Embed interop types" is turned off for all Esri references. Second, try IMemoryBlobStream instead of IBlobStream (this really shouldn't make a difference though). Commented Apr 16, 2013 at 15:49
  • 1
    @Petr Krebs Ohh right... I were making this in new project, and forgot to set Embed interop types to false so they would no longer by dynamic - problem solved, Thanks! You can actually make it as an answer I guess. Commented Apr 17, 2013 at 6:21

1 Answer 1

1

Ensure that "Embed interop types" is turned off for all Esri interop assembly references.

answered May 24, 2013 at 16:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.