xxxxxxxxxx
using (var connection = new SqlConnection("YourConnectionString"))
{
connection.Open();
string sql = "SELECT YourField FROM YourTable WHERE Id = @Id";
var result = await connection.QueryFirstOrDefaultAsync<string>(sql, new { Id = 1 });
// Convert the retrieved field value to another type
int convertedValue = Convert.ToInt32(result);
// Further processing with the converted value
// ...
connection.Close();
}