This question is locked. New answers and comments are not allowed.
Hi sir,
I am using the following code to return two fields from the table TestTable where the field FileContent datatype is Image or VarBinary .
I got the following exception:-
System.InvalidCastException was unhandled
Message=Object must implement IConvertible.
Source=mscorlib
StackTrace:
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Telerik.OpenAccess.Query.NullableConverter`1.Convert(ResultData& data)
at Telerik.OpenAccess.Query.ArrayConverter`1.Convert(ResultData& data)
at Telerik.OpenAccess.Query.ObjectConstructor.Convert(ResultData& data)
at Telerik.OpenAccess.Query.TypedEnumerator`1.ObtainCurrent()
at Telerik.OpenAccess.Query.TypedEnumerator`1.System.Collections.Generic.IEnumerator<T>.get_Current()
... Local paths ...
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at ... Local paths ...
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I am using the following code to return two fields from the table TestTable where the field FileContent datatype is Image or VarBinary .
var q = (from tt
in
objScope.Extent<TestTable>()
select
new
{ tt.FileID, tt.FileContent }).ToList();
I got the following exception:-
System.InvalidCastException was unhandled
Message=Object must implement IConvertible.
Source=mscorlib
StackTrace:
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Telerik.OpenAccess.Query.NullableConverter`1.Convert(ResultData& data)
at Telerik.OpenAccess.Query.ArrayConverter`1.Convert(ResultData& data)
at Telerik.OpenAccess.Query.ObjectConstructor.Convert(ResultData& data)
at Telerik.OpenAccess.Query.TypedEnumerator`1.ObtainCurrent()
at Telerik.OpenAccess.Query.TypedEnumerator`1.System.Collections.Generic.IEnumerator<T>.get_Current()
... Local paths ...
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at ... Local paths ...
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: