Hello guys, i have a problem. I have a data table that i got from run querry activity, I need to add columns to the data table. Im trying to use invoke code, because I need to set specific data types for theese columns. The invoke code looks like this:
dt_datatable.Columns.Add("STATUS", GetType(String))
dt_datatable.Columns.Add("Status_Date", GetType(DateTime))
dt_datatable.Columns.Add("USER", GetType(String))
dt_datatable.Columns.Add("TiekejoID", GetType(Int32))
But I get an error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at UiPathCodeRunner_dfcd0dc2c1b74a2ca599b5b1af30e9cf.Run(DataTable dt_datatable)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Run(Object[] args)
at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List`1 inArgs, IEnumerable`1 imps, Object[] args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)