Files
codeql/csharp/ql/test/query-tests/API Abuse/DisposeNotCalledOnException/DisposeNotCalledOnExceptionGood.cs
2018-08-02 17:53:23 +01:00

18 lines
375 B
C#

using System;
using System.Data.SqlClient;
class Good
{
public SqlDataReader GetAllCustomers()
{
using (var conn = new SqlConnection("connection string"))
{
conn.Open();
using (var cmd = new SqlCommand("SELECT * FROM Customers", conn))
{
return cmd.ExecuteReader();
}
}
}
}