I want to run a query that gets all the current learner's assignment items after an assignment is submitted. I found the code that runs when the "Submit" button is clicked. From there I'm opening a new SqlConnection using the connection string
from the SlkSPSiteMapping object:
bool mappingExists = SlkSPSiteMapping.GetMapping(SPWeb.Site.ID, out mapping);
string connStr = mapping.DatabaseConnectionString;
using (SqlConnection conn = new SqlConnection(connStr))
// run query here...
The SqlCommand object text is simply: "SELECT * FROM LearnerAssignmentItem WHERE LearnerId = @learnerId"
However, when I execute the command the query times out. I've tried a couple of tests and it seems the only way I can get the query not to time out is when I add a where clause with the Id field (e.g. WHERE Id = 200). I also tried running the
query from a dummy app and it works just fine. It is only when I'm in the context of the SLK that I get the time outs. What is the best way to create queries against the SLK database?