This topic is locked
[SOLVED]

 Update Multiple Records on the List Page

2/23/2015 5:55:27 PM
ASPRunner.NET General questions
P
precisiondi author

Hi I'm trying to update multiple records on the list page when a button is clicked. The button global on the page and not in the data grid. I'm using this example from the manual but I keeping getting errors. The strange thing is that the database is updated with the new value. I'm open to suggestions as well.
for (int i=0; i < keys.Count(); i++)

{

// set ReportsTo field to 'Bob Smith'

string sql = "Update employees set ReportsTo='Bob Smith' where KeyField=" + keys[i]["KeyField"].ToString();

tDAL.CustomQuery(sql);

}

result["txt"] = "Records were updated.";
This is the error that I'm getting
Server Error in '/AAConvert' Application.
Cannot perform runtime binding on a null reference
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot perform runtime binding on a null reference
Source Error:
Line 14: {

Line 15: var connection = CommonFunctions.getDefaultConnection();

Line 16: return connection.query(dalSQL).getQueryHandle();

Line 17: }

Line 18:
Source File: c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\Classes\tDal.cs Line: 16
Stack Trace:
[RuntimeBinderException: Cannot perform runtime binding on a null reference]

CallSite.Target(Closure , CallSite , Object ) +115

System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +432

runnerDotNet.tDAL.CustomQuery(XVar dalSQL) in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\Classes\tDal.cs:16

runnerDotNet.CommonEvents.Update_Selected(Object context) in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\include\CommonEvents.cs:37

CallSite.Target(Closure , CallSite , IGlobalEventProviderCS , Object ) +121

System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2(CallSite site, T0 arg0, T1 arg1) +450

runnerDotNet.class_GlobalEvents.Update_Selected(Object context) in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\include\EventsAggregatorGlobal.cs:136

CallSite.Target(Closure , CallSite , Object , XVar ) +123

System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid2(CallSite site, T0 arg0, T1 arg1) +450

runnerDotNet.GlobalController.buttonHandler_Update_Selected(Object _param_params) in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\buttonhandler.cs:52

runnerDotNet.GlobalController.buttonhandler() in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\buttonhandler.cs:26

lambdamethod(Closure , ControllerBase , Object[] ) +62

System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14

System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary2 parameters) +181
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary
2 parameters) +27

System.Web.Mvc.<>cDisplayClass15.<InvokeActionMethodWithFilters>b12() +56

System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func1 continuation) +256
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +22
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList
1 filters, ActionDescriptor actionDescriptor, IDictionary2 parameters) +190
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +311
System.Web.Mvc.Controller.ExecuteCore() +105
runnerDotNet.BaseController.ExecuteThread(Object arg) in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\Controllers\BaseController.cs:45

[AggregateException: One or more errors occurred.]
runnerDotNet.BaseController.ExecuteCore() in c:\Users\jlong\Documents\ASPRunnerNETProjects\ReadyDoc File Linking\output\Controllers\BaseController.cs:32
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +88
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
System.Web.Mvc.Async.<>c__DisplayClass8
1.<BeginSynchronous>b__7(IAsyncResult
) +10

System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55

System.Web.Mvc.<>cDisplayClasse.<EndProcessRequest>bd() +31

System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7

System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23

System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59

System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9651116

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

admin 2/25/2015

Bug in ASPRunner.NET 8.0 build 23504. The issue was fixed and will be available in the next update.