Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qwiq does not support variables in queries #206

Open
rjmurillo opened this issue Oct 12, 2018 · 0 comments
Open

Qwiq does not support variables in queries #206

rjmurillo opened this issue Oct 12, 2018 · 0 comments

Comments

@rjmurillo
Copy link
Member

You can use variables in queries to pass user input or calculated values. To create a query that includes variables, create placeholders in the query string using @variable, where "variable" is the name of the variable. Then pass the name (less the "@") and value of each into a dictionary as shown.

// Define a query that uses a variable for the type of work item. 
string queryString = "Select [State], [Title] From WorkItems Where [Work Item Type] = @Type";

// Set up a dictionary to pass "User Story" as the value of the type variable.
Dictionary<string, string> variables = new Dictionary<string, string>();
variables.Add("Type", "User Story");

// Create and run the query.
Query query = new Query(workItemStore, queryString, variables); 
WorkItemCollection results = query.RunQuery();
@rjmurillo rjmurillo added this to the Next Tasks milestone Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant