This is my Select
using (SqlConnection con = new SqlConnection(dc.Con))
{
SqlDataAdapter da = new SqlDataAdapter(
"Select DateOfBirth FROM Patients WHERE HealthNumber='" + cmbHealthNumber.Text+ "'", con);
How do I go about calculating the age of the client changing my above code
I try but I never solve this problem…
Thanks for helping me!
If you only need to retrieve a single
DateTime, why not use:There’s really no need to go through all the trouble of having a
SqlDataAdapterand aDataTableorDataSetjust for a single value …..Also: always use parametrized queries! – NO exceptions. Prevent SQL injection – and you definitely don’t want that!