Posts

Showing posts with the label Query

Retrieve other table 's data within a TableController - Azure Mobile App Service .NET backend

I created a custom Table controller called "TaskItemController" in Azure Mobile App Service .NET backend and needs to retrieve data from other tables. I using the code "context.TodoItems.SqlQuery" to retrieve data from "TodoItems" table. The variable "context" is initialized in method "Initialize(HttpControllerContext controllerContext)" within table controller. The following is a sample code to retrieve data from other table "TodoItems". // POST tables/TaskItem  public async Task<IHttpActionResult> PostTaskItem(TaskItem item) {          var query = context.TodoItems.SqlQuery("Select * from TaskItems where Id='" + item.TaskId + "'").FirstOrDefault<TaskItem>();           //Get data column's value         var taskName=query.TaskName; }