You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More samples for the Azure SQL input binding are available in the [GitHub repository](https://github.com/Azure/azure-functions-sql-extension/tree/main/samples/samples-csharpscript).
244
+
245
+
This section contains the following examples:
246
+
247
+
*[HTTP trigger, get row by ID from query string](#http-trigger-look-up-id-from-query-string-csharpscript)
The following example shows an Azure SQL input binding in a *function.json* file and a [C# script function](functions-reference-csharp.md) that uses the binding. The function is triggered by an HTTP request that uses a query string to specify the ID. That ID is used to retrieve a `ToDoItem` record with the specified query.
260
+
261
+
> [!NOTE]
262
+
> The HTTP query string parameter is case-sensitive.
263
+
>
264
+
265
+
Here's the binding data in the *function.json* file:
266
+
267
+
```json
268
+
{
269
+
"authLevel": "anonymous",
270
+
"type": "httpTrigger",
271
+
"direction": "in",
272
+
"name": "req",
273
+
"methods": [
274
+
"get"
275
+
]
276
+
},
277
+
{
278
+
"type": "http",
279
+
"direction": "out",
280
+
"name": "res"
281
+
},
282
+
{
283
+
"name": "todoItem",
284
+
"type": "sql",
285
+
"direction": "in",
286
+
"commandText": "select [Id], [order], [title], [url], [completed] from dbo.ToDo where Id = @Id",
287
+
"commandType": "Text",
288
+
"parameters": "@Id = {Query.id}",
289
+
"connectionStringSetting": "SqlConnectionString"
290
+
}
291
+
```
292
+
293
+
The [configuration](#configuration) section explains these properties.
The following example shows an Azure SQL input binding in a *function.json* file and a [C# script function](functions-reference-csharp.md) that uses the binding to execute a stored procedure with input from the HTTP request query parameter. In this example, the stored procedure deletes a single record or all records depending on the value of the parameter.
317
+
318
+
The stored procedure `dbo.DeleteToDo` must be created on the SQL database.
0 commit comments