Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 9e71480

Browse files
committed
change SqlProc to use a using statement
1 parent 1b89d8e commit 9e71480

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,11 +1188,13 @@ string spSql = @"DROP PROCEDURE IF EXISTS spSearchLetters;
11881188

11891189
db.ExecuteSql(spSql);
11901190

1191-
var cmd = db.SqlProc("spSearchLetters", new { pLetter = "C" });
1192-
var pTotal = cmd.AddParam("pTotal", direction: ParameterDirection.Output);
1191+
using (var cmd = db.SqlProc("spSearchLetters", new { pLetter = "C" }))
1192+
{
1193+
var pTotal = cmd.AddParam("pTotal", direction: ParameterDirection.Output);
11931194

1194-
var results = cmd.ConvertToList<LetterFrequency>();
1195-
var total = pTotal.Value;
1195+
var results = cmd.ConvertToList<LetterFrequency>();
1196+
var total = pTotal.Value;
1197+
}
11961198
```
11971199

11981200
An alternative approach is to use `SqlList` which lets you use a filter to customize a

0 commit comments

Comments
 (0)