I am trying to execute a sql query as another input using the Run As command. I use Linq for SQL, so I created the Data Context class, and I use the ExecuteQuery method to run the SQL Execute As command. Then I invoke the Linq to SQL command, which succeeds. However, each subsequent request fails with the following error:
A serious error occurred in the current team. Results, if any, should be discarded.
Here is the code snippet I tried:
SummaryDataContext summary = new SummaryDataContext();
summary.ExecuteQuery<CustomPostResult>(@"Execute as Login='Titan\Administrator'");
var test = summary.Customers.First();
var test2 = summary.Products.ToList();
No matter what request I run in the second request, I get an error message at the top. Any help would be greatly appreciated.