Please, i can convert this method to uses Dapper?
- "BuscarUltimasLeituras" is a procedure
- "@Last" is a param of procedure (int)
public DataTable GetLeituras ( int ultimas )
{
DataTable listaLeiturasRomaneio = new DataTable();
try
{
_sqlConnection.Open();
_sqlCommand = new SqlCommand();
_sqlCommand.Connection = _sqlConnection;
_sqlCommand.CommandText = "BuscarUltimasLeituras";
_sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
_sqlCommand.Parameters.Add("@Last", SqlDbType.Int).Value = ultimas;
_sqlAdapter = new SqlDataAdapter(_sqlCommand);
_sqlAdapter.Fill(listaLeiturasRomaneio);
}
catch ( SqlException )
{
listaLeiturasRomaneio = null;
}
finally
{
_sqlConnection.Close();
}
return listaLeiturasRomaneio;
}