c# - InvalidCastException when converting String to String -


i've got unexplained error when working on controller class in rest api i'm working on.

the api takes datacomponent , gets data view. 1 of columns in view engineeringname(varchar(250), null)

when i'm iterating on dataset build jsonobject debugger shows me error:

an exception of type 'system.invalidcastexception' occurred in restfulwebapi.dll not handled in user code

this line fails on:

string engineername = row["engineername"].tostring(); 

the debugger's immediate window shows me when error occurs , check value is:

>>> ?row["engineername"]     >>> "j bloggs" 

and

 >>> ?row["engineername"].tostring()      >>> "j bloggs" 

i'm not sure other information can supply guys provide minimal, complete, , verifiable example please tell me if need else.

edits below:

stack trace:

restfulwebapi.dll!restfulwebapi.controllers.ole_foundationscontroller.getall() line 86 c#

(refers line i've supplied)

it seem visual studio's stack traces work in way refers line, exception may on line above (in cases). in case invalidcastexception referring line 86, castexception occuring on line 85.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -